[Python-checkins] r76804 - python/trunk/Lib/test/test_strptime.py

ezio.melotti python-checkins at python.org
Sun Dec 13 19:54:53 CET 2009


Author: ezio.melotti
Date: Sun Dec 13 19:54:53 2009
New Revision: 76804

Log:
#7342: make sure that the datetime object in test_fraction always has a number of microseconds != 0

Modified:
   python/trunk/Lib/test/test_strptime.py

Modified: python/trunk/Lib/test/test_strptime.py
==============================================================================
--- python/trunk/Lib/test/test_strptime.py	(original)
+++ python/trunk/Lib/test/test_strptime.py	Sun Dec 13 19:54:53 2009
@@ -274,10 +274,11 @@
         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


More information about the Python-checkins mailing list