summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_datetime.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r--Lib/test/test_datetime.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index 658b390..4818482 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -79,7 +79,7 @@ class TestTZInfo(unittest.TestCase):
self.__name = name
self.assertTrue(issubclass(NotEnough, tzinfo))
ne = NotEnough(3, "NotByALongShot")
- self.assertTrue(isinstance(ne, tzinfo))
+ self.assertIsInstance(ne, tzinfo)
dt = datetime.now()
self.assertRaises(NotImplementedError, ne.tzname, dt)
@@ -88,7 +88,7 @@ class TestTZInfo(unittest.TestCase):
def test_normal(self):
fo = FixedOffset(3, "Three")
- self.assertTrue(isinstance(fo, tzinfo))
+ self.assertIsInstance(fo, tzinfo)
for dt in datetime.now(), None:
self.assertEqual(fo.utcoffset(dt), timedelta(minutes=3))
self.assertEqual(fo.tzname(dt), "Three")
@@ -109,14 +109,14 @@ class TestTZInfo(unittest.TestCase):
# Make sure we can pickle/unpickle an instance of a subclass.
offset = timedelta(minutes=-300)
orig = PicklableFixedOffset(offset, 'cookie')
- self.assertTrue(isinstance(orig, tzinfo))
+ self.assertIsInstance(orig, tzinfo)
self.assertTrue(type(orig) is PicklableFixedOffset)
self.assertEqual(orig.utcoffset(None), offset)
self.assertEqual(orig.tzname(None), 'cookie')
for pickler, unpickler, proto in pickle_choices:
green = pickler.dumps(orig, proto)
derived = unpickler.loads(green)
- self.assertTrue(isinstance(derived, tzinfo))
+ self.assertIsInstance(derived, tzinfo)
self.assertTrue(type(derived) is PicklableFixedOffset)
self.assertEqual(derived.utcoffset(None), offset)
self.assertEqual(derived.tzname(None), 'cookie')
@@ -382,9 +382,9 @@ class TestTimeDelta(HarmlessMixedComparison, unittest.TestCase):
self.assertEqual(td, td2)
def test_resolution_info(self):
- self.assertTrue(isinstance(timedelta.min, timedelta))
- self.assertTrue(isinstance(timedelta.max, timedelta))
- self.assertTrue(isinstance(timedelta.resolution, timedelta))
+ self.assertIsInstance(timedelta.min, timedelta)
+ self.assertIsInstance(timedelta.max, timedelta)
+ self.assertIsInstance(timedelta.resolution, timedelta)
self.assertTrue(timedelta.max > timedelta.min)
self.assertEqual(timedelta.min, timedelta(-999999999))
self.assertEqual(timedelta.max, timedelta(999999999, 24*3600-1, 1e6-1))
@@ -895,9 +895,9 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
self.assertEqual(b.__format__(fmt), 'B')
def test_resolution_info(self):
- self.assertTrue(isinstance(self.theclass.min, self.theclass))
- self.assertTrue(isinstance(self.theclass.max, self.theclass))
- self.assertTrue(isinstance(self.theclass.resolution, timedelta))
+ self.assertIsInstance(self.theclass.min, self.theclass)
+ self.assertIsInstance(self.theclass.max, self.theclass)
+ self.assertIsInstance(self.theclass.resolution, timedelta)
self.assertTrue(self.theclass.max > self.theclass.min)
def test_extreme_timedelta(self):
@@ -1881,9 +1881,9 @@ class TestTime(HarmlessMixedComparison, unittest.TestCase):
"%s(23, 15)" % name)
def test_resolution_info(self):
- self.assertTrue(isinstance(self.theclass.min, self.theclass))
- self.assertTrue(isinstance(self.theclass.max, self.theclass))
- self.assertTrue(isinstance(self.theclass.resolution, timedelta))
+ self.assertIsInstance(self.theclass.min, self.theclass)
+ self.assertIsInstance(self.theclass.max, self.theclass)
+ self.assertIsInstance(self.theclass.resolution, timedelta)
self.assertTrue(self.theclass.max > self.theclass.min)
def test_pickling(self):
@@ -2251,7 +2251,7 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase):
green = pickler.dumps(orig, proto)
derived = unpickler.loads(green)
self.assertEqual(orig, derived)
- self.assertTrue(isinstance(derived.tzinfo, PicklableFixedOffset))
+ self.assertIsInstance(derived.tzinfo, PicklableFixedOffset)
self.assertEqual(derived.utcoffset(), timedelta(minutes=-300))
self.assertEqual(derived.tzname(), 'cookie')
@@ -2478,8 +2478,7 @@ class TestDateTimeTZ(TestDateTime, TZInfoBase, unittest.TestCase):
green = pickler.dumps(orig, proto)
derived = unpickler.loads(green)
self.assertEqual(orig, derived)
- self.assertTrue(isinstance(derived.tzinfo,
- PicklableFixedOffset))
+ self.assertIsInstance(derived.tzinfo, PicklableFixedOffset)
self.assertEqual(derived.utcoffset(), timedelta(minutes=-300))
self.assertEqual(derived.tzname(), 'cookie')