fix: time regex

This commit is contained in:
aclist authored and GitHub committed 2026-08-16 13:40:08 +09:00
1 parent ce1cad6dcf
commit a72d692c68
2 files changed
+28 -2

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import pytest
import re
day = r"([0][7-9]|[1][0-6])"
night = r"([0][0-6]|[1][7-9]|[2][0-3])"
pytestmark = pytest.mark.FOO
def iterate(h: str, r: str) -> None:
for m in range(60):
time = f"{h:02}:{m:02}"
assert re.match(r, time) is not None
def test_day() -> None:
for h in range(17):
if h < 7:
continue
iterate(h, day)
def test_night() -> None:
for h in range(24):
if 6 < h < 17:
continue
iterate(h, night)