<commit_before>import os
import json
import subprocess
import string
import datetime

from nose.tools import eq_
from hypothesis import given, settings
from hypothesis.strategies import *

import jsone
from jsone.render import operators as defined_operators
from jsone.builtins import builtins as defined_builtins

def setup_module():
    global old_utcnow
    old_utcnow = jsone.shared.utcnow

def teardown_module():
    jsone.shared.utcnow = old_utcnow

def py(when, template, context):
    when = datetime.datetime.utcfromtimestamp(when)
    jsone.shared.utcnow = lambda: when
    try:
        return jsone.render(template, context)
    except jsone.JSONTemplateError:
        return Exception


def js(when, template, context):
    input = json.dumps({'template': template, 'context': context})
    command = ['node', '-e', ' '.join([
        'var jsone = require("./lib").default, fs = require("fs"), tk = require("timekeeper");',
        'var input = JSON.parse(fs.readFileSync("/dev/stdin").toString());',
        'tk.freeze(new Date(' + str(when) + '000));',
        'var output = JSON.stringify(jsone(input.template, input.context));',
        'console.log(output);'])]
    proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate(input.encode('utf-8'))
    returncode = proc.wait()
    if returncode:
        return Exception
    try:
        return json.loads(stdout.decode('utf-8'))
    except Exception:
        print(stdout.decode('utf-8'))
        print(stderr.decode('utf-8'))
        raise


def make_strategies():<commit_msg>Fix prop test<commit_after>import os
import json
import subprocess
import string
import datetime

from nose.tools import eq_
from hypothesis import given, settings
from hypothesis.strategies import *

import jsone
from jsone.render import operators as defined_operators
from jsone.builtins import builtins as defined_builtins

def setup_module():
    global old_utcnow
    old_utcnow = jsone.shared.utcnow

def teardown_module():
    jsone.shared.utcnow = old_utcnow

def py(when, template, context):
    when = datetime.datetime.utcfromtimestamp(when)
    jsone.shared.utcnow = lambda: when
    try:
        return jsone.render(template, context)
    except jsone.JSONTemplateError:
        return Exception


def js(when, template, context):
    input = json.dumps({'template': template, 'context': context})
    command = ['node', '-e', ' '.join([
        'var jsone = require("./src"), fs = require("fs"), tk = require("timekeeper");',
        'var input = JSON.parse(fs.readFileSync("/dev/stdin").toString());',
        'tk.freeze(new Date(' + str(when) + '000));',
        'var output = JSON.stringify(jsone(input.template, input.context));',
        'console.log(output);'])]
    proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate(input.encode('utf-8'))
    returncode = proc.wait()
    if returncode:
        return Exception
    try:
        return json.loads(stdout.decode('utf-8'))
    except Exception:
        print(stdout.decode('utf-8'))
        print(stderr.decode('utf-8'))
        raise


def make_strategies():
{'fraction_non_alphanumeric': 0.13023399014778325, 'fraction_numerical': 0.004310344827586207, 'mean_word_length': 3.6815561959654177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5767485', 'n_tokens_mistral': 1003, 'n_tokens_neox': 994, 'n_words': 239}