コード例 #1
0
    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)
コード例 #2
0
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))
コード例 #3
0
 def test_parse_encoding(self):
     asn1tools.parse_files('tests/files/foo.asn', encoding='ascii')