[utils] Improve `parse_duration`

Authored by: bashonly
pull/7616/head^2
bashonly 1 year ago
parent 75dc8e673b
commit af86873218
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

@ -655,6 +655,8 @@ class TestUtil(unittest.TestCase):
self.assertEqual(parse_duration('P0Y0M0DT0H4M20.880S'), 260.88)
self.assertEqual(parse_duration('01:02:03:050'), 3723.05)
self.assertEqual(parse_duration('103:050'), 103.05)
self.assertEqual(parse_duration('1HR 3MIN'), 3780)
self.assertEqual(parse_duration('2hrs 3mins'), 7380)
def test_fix_xml_ampersands(self):
self.assertEqual(

@ -2021,7 +2021,7 @@ def parse_duration(s):
)?
T)?
(?:
(?P<hours>[0-9]+)\s*h(?:ours?)?,?\s*
(?P<hours>[0-9]+)\s*h(?:(?:ou)?rs?)?,?\s*
)?
(?:
(?P<mins>[0-9]+)\s*m(?:in(?:ute)?s?)?,?\s*

Loading…
Cancel
Save