Harden main loop and store; by-id device default, BOARD_TZ
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
8649d3abd0
commit
44a1b3cf8c
7 files changed
+100
-30
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pytest
|
||||
@@ -79,3 +80,17 @@ def test_load_lines_reads_yaml(tmp_path):
|
||||
def test_repo_lines_yaml_lists_the_four_lines():
|
||||
labels = [c.label for c in store.load_lines(ROOT / "lines.yaml")]
|
||||
assert labels == ["4 Štípa,u potoka", "5 Štípa,u potoka", "35 Štípa,družstvo", "36 Štípa,družstvo"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("content", ["[]", "null", "42", '"x"'])
|
||||
def test_fetched_json_that_is_not_an_object_is_ignored(tmp_path, content):
|
||||
(tmp_path / store.FETCHED_FILE).write_text(content, encoding="utf-8")
|
||||
assert store.is_stale([LINE4], tmp_path, NOW) is True
|
||||
report = store.refresh([LINE4], tmp_path, fetch=good_page, now=NOW)
|
||||
assert report.updated == [LINE4.label]
|
||||
assert store.is_stale([LINE4], tmp_path, NOW) is False
|
||||
|
||||
|
||||
def test_fetched_json_with_non_string_value_is_stale_not_an_error(tmp_path):
|
||||
(tmp_path / store.FETCHED_FILE).write_text(json.dumps({LINE4.label: 5}), encoding="utf-8")
|
||||
assert store.is_stale([LINE4], tmp_path, NOW) is True
|
||||
Reference in new issue
Block a user