mirror of
https://github.com/aclist/dztui.git
synced 2026-08-29 11:17:12 +02:00
fix: time regex
This commit is contained in:
parent
ce1cad6dcf
commit
a72d692c68
@ -231,10 +231,10 @@ class ProxyModelManager:
|
|||||||
final.append(row)
|
final.append(row)
|
||||||
rows = final
|
rows = final
|
||||||
case strings.filter_day:
|
case strings.filter_day:
|
||||||
reg = r"([0][0-9]|[1][0-6])"
|
reg = r"([0][7-9]|[1][0-6])"
|
||||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||||
case strings.filter_night:
|
case strings.filter_night:
|
||||||
reg = r"([0][0-4]|[1][8]|[2][0-3])"
|
reg = r"([0][0-6]|[1][7-9]|[2][0-3])"
|
||||||
rows = [row for row in rows if not re.match(reg, row[3])]
|
rows = [row for row in rows if not re.match(reg, row[3])]
|
||||||
case strings.filter_nonascii:
|
case strings.filter_nonascii:
|
||||||
rows = [row for row in rows if row[0].isascii()]
|
rows = [row for row in rows if row[0].isascii()]
|
||||||
|
|||||||
26
tests/test_time.py
Normal file
26
tests/test_time.py
Normal 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)
|
||||||
Loading…
Reference in New Issue
Block a user