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
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