def parse_and_verify(self, module, path='.'): asn_path = 'tests/files/' + path + '/' + module + '.asn' actual = asn1tools.parse_files(asn_path) # from pprint import pformat # # py_path = 'tests/files/' + path + '/' + module + '.py' # # with open(py_path, 'w') as fout: # fout.write('EXPECTED = ' + pformat(actual)) module = importlib.import_module(module) self.assertEqual(actual, module.EXPECTED)
def method_compile_dict(): dictionary = asn1tools.parse_files(RRC_8_6_0_ASN_PATH) print("Compiling RRC_8_6_0 dictionary... ", end='', flush=True) def compile_dict(): asn1tools.compile_dict(dictionary) time = timeit.timeit(compile_dict, number=ITERATIONS) print('done.') return round(time, 5), len(str(dictionary))
def test_parse_encoding(self): asn1tools.parse_files('tests/files/foo.asn', encoding='ascii')