summaryrefslogtreecommitdiff
path: root/tests/type/test_useful.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/type/test_useful.py')
-rw-r--r--tests/type/test_useful.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/type/test_useful.py b/tests/type/test_useful.py
index dbd6fe0..717eede 100644
--- a/tests/type/test_useful.py
+++ b/tests/type/test_useful.py
@@ -6,14 +6,16 @@
#
import sys
import datetime
-from pyasn1.type import useful
-from pyasn1.error import PyAsn1Error
try:
import unittest2 as unittest
+
except ImportError:
import unittest
+from tests.base import BaseTestCase
+
+from pyasn1.type import useful
class FixedOffset(datetime.tzinfo):
def __init__(self, offset, name):
@@ -34,11 +36,11 @@ UTC = FixedOffset(0, 'UTC')
UTC2 = FixedOffset(120, 'UTC')
-class ObjectDescriptorTestCase(unittest.TestCase):
+class ObjectDescriptorTestCase(BaseTestCase):
pass
-class GeneralizedTimeTestCase(unittest.TestCase):
+class GeneralizedTimeTestCase(BaseTestCase):
def testFromDateTime(self):
assert useful.GeneralizedTime.fromDateTime(datetime.datetime(2017, 7, 11, 0, 1, 2, 30000, tzinfo=UTC)) == '20170711000102.3Z'
@@ -71,7 +73,7 @@ class GeneralizedTimeTestCase(unittest.TestCase):
assert datetime.datetime(2017, 7, 11, 0) == useful.GeneralizedTime('2017071100').asDateTime
-class UTCTimeTestCase(unittest.TestCase):
+class UTCTimeTestCase(BaseTestCase):
def testFromDateTime(self):
assert useful.UTCTime.fromDateTime(datetime.datetime(2017, 7, 11, 0, 1, 2, tzinfo=UTC)) == '170711000102Z'