Skip to content

Commit f77cdf8

Browse files
author
Alexander Smishlajev
committed
Interval.from_seconds() produces a buggy output with float argument
1 parent 4396bc1 commit f77cdf8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/test_dates.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17-
#
18-
# $Id: test_dates.py,v 1.33 2004-09-29 07:27:09 richard Exp $
17+
#
18+
# $Id: test_dates.py,v 1.34 2004-11-29 14:30:55 a1s Exp $
1919
from __future__ import nested_scopes
2020

2121
import unittest, time
@@ -170,6 +170,7 @@ def testIntervalInit(self):
170170
ae(str(Interval(' - 1 d 2:50 ')), '- 1d 2:50')
171171
ae(str(Interval(' 14:00 ')), '+ 14:00')
172172
ae(str(Interval(' 0:04:33 ')), '+ 0:04:33')
173+
ae(str(Interval(8.*3600)), '+ 08:00')
173174

174175
def testIntervalInitDate(self):
175176
ae = self.assertEqual
@@ -338,7 +339,7 @@ def testGranularity(self):
338339
ae(str(Date('2003-5', add_granularity=1)), '2003-05-31.23:59:59')
339340
ae(str(Interval('+1w', add_granularity=1)), '+ 14d')
340341
ae(str(Interval('-2m 3w', add_granularity=1)), '- 2m 14d')
341-
342+
342343
def testIntervalPretty(self):
343344
def ae(spec, pretty):
344345
self.assertEqual(Interval(spec).pretty(), pretty)
@@ -361,7 +362,7 @@ def ae(spec, pretty):
361362
ae('01:45:00', 'in 1 3/4 hours')
362363
ae('01:30:00', 'in 1 1/2 hours')
363364
ae('01:29:00', 'in 1 1/4 hours')
364-
ae('01:00:00', 'in an hour')
365+
ae('01:00:00', 'in an hour')
365366
ae('00:30:00', 'in 1/2 an hour')
366367
ae('00:15:00', 'in 1/4 hour')
367368
ae('00:02:00', 'in 2 minutes')
@@ -389,4 +390,4 @@ def test_suite():
389390
runner = unittest.TextTestRunner()
390391
unittest.main(testRunner=runner)
391392

392-
# vim: set filetype=python ts=4 sw=4 et si
393+
# vim: set filetype=python ts=4 sw=4 et si :

0 commit comments

Comments
 (0)