]> granicus.if.org Git - python/commitdiff
Issue #26198: Make datetime error tests more lenient.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 8 Feb 2016 07:25:53 +0000 (09:25 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 8 Feb 2016 07:25:53 +0000 (09:25 +0200)
Lib/test/datetimetester.py

index 6365c605791f12e2898a5c2c0b87078423a725c0..63bfed53965f73047e3748184f3ca9ecc01cf7b4 100644 (file)
@@ -1239,7 +1239,7 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
         dt = self.theclass(2007, 9, 10)
         self.assertEqual(dt.__format__(''), str(dt))
 
-        with self.assertRaisesRegex(TypeError, '^must be str, not int$'):
+        with self.assertRaisesRegex(TypeError, 'must be str, not int'):
             dt.__format__(123)
 
         # check that a derived class's __str__() gets called
@@ -1574,7 +1574,7 @@ class TestDateTime(TestDate):
         dt = self.theclass(2007, 9, 10, 4, 5, 1, 123)
         self.assertEqual(dt.__format__(''), str(dt))
 
-        with self.assertRaisesRegex(TypeError, '^must be str, not int$'):
+        with self.assertRaisesRegex(TypeError, 'must be str, not int'):
             dt.__format__(123)
 
         # check that a derived class's __str__() gets called
@@ -2336,7 +2336,7 @@ class TestTime(HarmlessMixedComparison, unittest.TestCase):
         t = self.theclass(1, 2, 3, 4)
         self.assertEqual(t.__format__(''), str(t))
 
-        with self.assertRaisesRegex(TypeError, '^must be str, not int$'):
+        with self.assertRaisesRegex(TypeError, 'must be str, not int'):
             t.__format__(123)
 
         # check that a derived class's __str__() gets called