summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2009-12-13 18:54:53 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2009-12-13 18:54:53 (GMT)
commite304852e21a92ef0a74c2d85c070572fddb4fba8 (patch)
tree1fb9c714c17017858fb413d858f01aa25a248b7f /Lib
parentc4771d2fe1c3f765cb01e5f808e10b797b430f8d (diff)
downloadcpython-e304852e21a92ef0a74c2d85c070572fddb4fba8.zip
cpython-e304852e21a92ef0a74c2d85c070572fddb4fba8.tar.gz
cpython-e304852e21a92ef0a74c2d85c070572fddb4fba8.tar.bz2
#7342: make sure that the datetime object in test_fraction always has a number of microseconds != 0
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_strptime.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index b7acc25..c37bdc7 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -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