def test_file_eval(*args): try: out = lab.evaluate_file(*args) return {'ok': True, 'output': out} except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() return {'ok': False, 'type': exc_type.__name__, 'exception': exc_obj.args}
def _test_file(fname, num): try: out = lab.evaluate_file(os.path.join('test_files', fname)) out = list_from_ll(out) out = {'ok': True, 'output': out} except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() out = {'ok': False, 'type': exc_type.__name__} with open('test_outputs/%s.json' % num) as f: expected = json.load(f) return out, expected
def _test_file(fname, num): try: out = lab.evaluate_file(os.path.join(TEST_DIRECTORY, 'test_files', fname)) out = list_from_ll(out) out = {'ok': True, 'output': out} except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() out = {'ok': False, 'type': exc_type.__name__} with open(os.path.join(TEST_DIRECTORY, 'test_outputs', f'{num}.json')) as f: expected = json.load(f) msg = _test_file_msg(fname, num) return out, expected, msg