summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2009-12-18 15:30:51 +0000
committerEzio Melotti <ezio.melotti@gmail.com>2009-12-18 15:30:51 +0000
commitae5657e1ffec42f075f93092a239052e33b951cb (patch)
tree2f2258c1c92803312ba1ac1110231bba8e4835b1
parent28b6e31d802eba9ddb4d5797402193aa406615ee (diff)
downloadcpython-git-ae5657e1ffec42f075f93092a239052e33b951cb.tar.gz
Merged revisions 76804 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76804 | ezio.melotti | 2009-12-13 20:54:53 +0200 (Sun, 13 Dec 2009) | 1 line #7342: make sure that the datetime object in test_fraction always has a number of microseconds != 0 ........
-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 2aa4bc9024..df0dc866b9 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