]> granicus.if.org Git - python/commitdiff
#7342: make sure that the datetime object in test_fraction always has a number of...
authorEzio Melotti <ezio.melotti@gmail.com>
Sun, 13 Dec 2009 18:54:53 +0000 (18:54 +0000)
committerEzio Melotti <ezio.melotti@gmail.com>
Sun, 13 Dec 2009 18:54:53 +0000 (18:54 +0000)
Lib/test/test_strptime.py

index b7acc252be3a376a9dcada0380b336a885d22124..c37bdc7f77e670e4ef6477c3746b2ddac3c6dda7 100644 (file)
@@ -274,10 +274,11 @@ class StrptimeTests(unittest.TestCase):
         self.helper('S', 5)
 
     def test_fraction(self):
+        # Test microseconds
         import datetime
-        now = datetime.datetime.now()
-        tup, frac = _strptime._strptime(str(now), format="%Y-%m-%d %H:%M:%S.%f")
-        self.assertEqual(frac, now.microsecond)
+        d = datetime.datetime(2012, 12, 20, 12, 34, 56, 78987)
+        tup, frac = _strptime._strptime(str(d), format="%Y-%m-%d %H:%M:%S.%f")
+        self.assertEqual(frac, d.microsecond)
 
     def test_weekday(self):
         # Test weekday directives