Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8c1255

Browse files
committed
Merged revisions 76875 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ................ r76875 | ezio.melotti | 2009-12-18 17:35:27 +0200 (Fri, 18 Dec 2009) | 9 lines Merged revisions 76804 via svnmerge from svn+ssh://[email protected]/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 ........ ................
1 parent 695de96 commit e8c1255

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/test/test_strptime.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ def test_second(self):
274274
self.helper('S', 5)
275275

276276
def test_fraction(self):
277+
# Test microseconds
277278
import datetime
278-
now = datetime.datetime.now()
279-
tup, frac = _strptime._strptime(str(now), format="%Y-%m-%d %H:%M:%S.%f")
280-
self.assertEqual(frac, now.microsecond)
279+
d = datetime.datetime(2012, 12, 20, 12, 34, 56, 78987)
280+
tup, frac = _strptime._strptime(str(d), format="%Y-%m-%d %H:%M:%S.%f")
281+
self.assertEqual(frac, d.microsecond)
281282

282283
def test_weekday(self):
283284
# Test weekday directives

0 commit comments

Comments
 (0)