X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=tests%2Ftest_pyderasn.py;h=fec6b763674bee4a60f98a4f98e7c6fbf8c272fb;hb=941eba18c136b2a70e97edc4e8b86134e27021ca;hp=90d50e9597a0cab8f7f101b9fa5f93abd3ae647a;hpb=44e10c60d857ea5e631927ac4b23365cc3b80698;p=pyderasn.git diff --git a/tests/test_pyderasn.py b/tests/test_pyderasn.py index 90d50e9..fec6b76 100644 --- a/tests/test_pyderasn.py +++ b/tests/test_pyderasn.py @@ -1,6 +1,6 @@ # coding: utf-8 # PyDERASN -- Python ASN.1 DER/CER/BER codec with abstract structures -# Copyright (C) 2017-2020 Sergey Matveev +# Copyright (C) 2017-2021 Sergey Matveev # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -3082,6 +3082,10 @@ class TestObjectIdentifier(CommonMixin, TestCase): data, ))) + def test_go_non_minimal_encoding(self): + with self.assertRaises(DecodeError): + ObjectIdentifier().decode(hexdec("060a2a80864886f70d01010b")) + def test_x690_vector(self): self.assertEqual( ObjectIdentifier().decode(hexdec("0603883703"))[0], @@ -4495,8 +4499,13 @@ class TestGeneralizedTime(TimeMixin, CommonMixin, TestCase): mktime(obj.todatetime().timetuple()), mktime(dt.timetuple()), ) - elif not PY2: - self.assertEqual(obj.todatetime().timestamp(), dt.timestamp()) + else: + try: + obj.todatetime().timestamp() + except: + pass + else: + self.assertEqual(obj.todatetime().timestamp(), dt.timestamp()) self.assertEqual(obj.ber_encoded, not dered) self.assertEqual(obj.bered, not dered) self.assertEqual(obj.ber_raw, None if dered else data)