diff options
author | niemeyer <> | 2008-02-28 03:42:33 +0000 |
---|---|---|
committer | niemeyer <> | 2008-02-28 03:42:33 +0000 |
commit | f296b1a67f3b6a58b81221da98c3cebc177ea31e (patch) | |
tree | d28650c5a32cd620c9bc57b32b5eaf0883a77166 /test.py | |
parent | d41f89a862e694afc10a6c1499f7d47d31c2d30c (diff) | |
download | dateutil-f296b1a67f3b6a58b81221da98c3cebc177ea31e.tar.gz |
Fixed another precision problem on conversion of decimal seconds to
microseconds, as reported by Erik Brown. Now they're gone for real,
since it's not using floating point arithmetic anymore.
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3557,6 +3557,20 @@ class ParserTest(unittest.TestCase): self.assertEquals(dt1.microsecond, 10000) self.assertEquals(dt2.microsecond, 10000) + def testMicrosecondPrecisionErrorReturns(self): + # One more precision issue, discovered by Eric Brown. This should + # be the last one, as we're no longer using floating points. + for ms in [100001, 100000, 99999, 99998, + 10001, 10000, 9999, 9998, + 1001, 1000, 999, 998, + 101, 100, 99, 98]: + dt = datetime(2008, 2, 27, 21, 26, 1, ms) + self.assertEquals(parse(dt.isoformat()), dt) + + def testHighPrecisionSeconds(self): + self.assertEquals(parse("20080227T21:26:01.123456789"), + datetime(2008, 2, 27, 21, 26, 1, 123456)) + def testCustomParserInfo(self): # Custom parser info wasn't working, as Michael Elsdörfer discovered. from dateutil.parser import parserinfo, parser |