Пример #1
0
import json
from kwik import kwik
import sys


if __name__== "__main__":
    if (not len(sys.argv) == 2):
        raise ValueError("Must pass a valid json test case")

    with open(sys.argv[1]) as test_file:
        data = json.load(test_file)

    results = kwik(data)

    result_str = ""
    for r in results:
        result_str = result_str + ',' + r

    print result_str

Пример #2
0
    b = np.array(a)
    episodes = map(list, b[:, 0])
    answers = list(b[:,1])
    num = len(episodes[0])

    result = {
            'name': 'student_example{0}'.format(ex),
            'numOfPatrons': num,
            'atEstablishment': episodes,
            'fightOccurred': answers,
            'output': output,
        }
    pp.pprint(result)

games = data()
for game in games:
    name = "test_{0}".format(game['name'])
    result = kwik(game)
    t = t_generator(game['output'], result)
    setattr(TestFight, name, t)

    maxIdks = game['numOfPatrons'] * (game['numOfPatrons'] - 1) - 1
    name = "test_{0}_maxidks".format(game['name'])
    idks = len([idk for idk in result if idk == "I DON'T KNOW"])
    t = t_max_generator(maxIdks, idks)
    setattr(TestFight, name, t)

if __name__ == "__main__":
    unittest.main()