Skip to content

Commit

Permalink
millisecondsが4桁以上になったらはじく
Browse files Browse the repository at this point in the history
  • Loading branch information
yncat committed Jan 12, 2024
1 parent b79c20b commit dd953bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion domain/duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def normalizeToFullPositionStr(positionStr):
if m3 is not None:
return millisecondsToPositionStr(int(m3.group(1)) * 1000 * 60 * 60 + int(m3.group(2)) * 1000 * 60 + int(m3.group(3)) * 1000)
# end if
m4 = re.match(r"^(\d+):(\d+):(\d+)\.(\d+)$", positionStr)
m4 = re.match(r"^(\d+):(\d+):(\d+)\.(\d{1,3})$", positionStr)
if m4 is not None:
return positionStr
#end if
Expand Down
1 change: 1 addition & 0 deletions test/domain_test/testDuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ def test_normalizeToFullPositionStr(self):
self.assertEqual(domain.normalizeToFullPositionStr("01:00:00"), "01:00:00.000")
self.assertEqual(domain.normalizeToFullPositionStr("01:01:01"), "01:01:01.000")
self.assertEqual(domain.normalizeToFullPositionStr("00:00:00.000"), "00:00:00.000")
self.assertRaises(ValueError, domain.normalizeToFullPositionStr, "00:00:13.4444")
self.assertRaises(ValueError, domain.normalizeToFullPositionStr, "aaaa")

0 comments on commit dd953bc

Please sign in to comment.