]> Cypherpunks.ru repositories - pyderasn.git/blobdiff - tests/test_pyderasn.py
Fix possible test's huge memory consumption
[pyderasn.git] / tests / test_pyderasn.py
index f31967375c2f0e123051ebed97f071941ce22367..f0071c3d50c37ecf53eb1ed8b761be95d634b98a 100644 (file)
@@ -1,6 +1,6 @@
 # coding: utf-8
 # PyDERASN -- Python ASN.1 DER/CER/BER codec with abstract structures
-# Copyright (C) 2017-2021 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2017-2022 Sergey Matveev <stargrave@stargrave.org>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as
@@ -34,7 +34,6 @@ from time import time
 from unittest import TestCase
 from unittest.mock import patch
 
-from dateutil.tz import tzutc
 from dateutil.tz import UTC
 from hypothesis import assume
 from hypothesis import given
@@ -680,7 +679,7 @@ class TestBoolean(CommonMixin, TestCase):
             repr(obj)
             list(obj.pps())
 
-    @given(integers(min_value=2))
+    @given(integers(min_value=2, max_value=10))
     def test_invalid_len(self, l):
         with self.assertRaises(InvalidLength):
             Boolean().decode(b"".join((
@@ -5065,15 +5064,12 @@ class TestUTCTime(TimeMixin, CommonMixin, TestCase):
             UTCTime(datetime(2000, 1, 1, 1, tzinfo=UTC))
 
     def test_raises_if_no_dateutil(self):
-        with patch("pyderasn.tzutc", new=None):
-            with self.assertRaisesRegex(
-                NotImplementedError,
-                "Package python-dateutil is required to use this feature",
-            ):
+        with patch("pyderasn.tzUTC", new="missing"):
+            with self.assertRaisesRegex(NotImplementedError, "dateutil"):
                 UTCTime(datetime.now()).totzdatetime()
 
     def test_tzinfo_gives_datetime_with_tzutc_tzinfo(self):
-        self.assertEqual(UTCTime(datetime.now()).totzdatetime().tzinfo, tzutc())
+        self.assertEqual(UTCTime(datetime.now()).totzdatetime().tzinfo, UTC)
 
 
 @composite