def run_tests(): for filename in glob("tests/*.json"): data = json.load(open(filename)) trains, events, result = data["trains"], data["events"], data["result"] got = process(trains, events, result["car"]) expected = result["amount"] if got != expected: print(error_message.format(filename, expected, got)) return print("All tests passed!")
def run_tests(): for filename in glob('tests/test2.json'): data = json.load(open(filename)) trains, events, result = data['trains'], data['events'], data['result'] got = process(trains, events, result['car']) expected = result['amount'] if got != expected: print(error_message.format(filename, expected, got)) return print("All tests passed!")
def run_tests(): i=0 for filename in glob('tests/*.json'): i=i+1 data = json.load(open(filename)) trains, events, result = data['trains'], data['events'], data['result'] print('test №', i, '\n', trains, '\n', events) got = process(trains, events, result['car']) expected = result['amount'] print("expected: ",result) print(trains) if got != expected: print(error_message.format(filename, expected, got)) return print("All tests passed!")