mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Added more assertions for parse_duration() with negative timedeltas.
This commit is contained in:
parent
577f2338f1
commit
57d05f94c3
@ -70,6 +70,7 @@ class DurationParseTests(unittest.TestCase):
|
||||
def test_parse_postgresql_format(self):
|
||||
test_values = (
|
||||
('1 day', timedelta(1)),
|
||||
('-1 day', timedelta(-1)),
|
||||
('1 day 0:00:01', timedelta(days=1, seconds=1)),
|
||||
('1 day -0:00:01', timedelta(days=1, seconds=-1)),
|
||||
('-1 day -0:00:01', timedelta(days=-1, seconds=-1)),
|
||||
@ -137,10 +138,15 @@ class DurationParseTests(unittest.TestCase):
|
||||
('P0.5D', timedelta(hours=12)),
|
||||
('P0,5D', timedelta(hours=12)),
|
||||
('PT5H', timedelta(hours=5)),
|
||||
('-PT5H', timedelta(hours=-5)),
|
||||
('PT5M', timedelta(minutes=5)),
|
||||
('-PT5M', timedelta(minutes=-5)),
|
||||
('PT5S', timedelta(seconds=5)),
|
||||
('-PT5S', timedelta(seconds=-5)),
|
||||
('PT0.000005S', timedelta(microseconds=5)),
|
||||
('PT0,000005S', timedelta(microseconds=5)),
|
||||
('-PT0.000005S', timedelta(microseconds=-5)),
|
||||
('-PT0,000005S', timedelta(microseconds=-5)),
|
||||
)
|
||||
for source, expected in test_values:
|
||||
with self.subTest(source=source):
|
||||
|
Loading…
Reference in New Issue
Block a user