init
This commit is contained in:
11
tests/test_feed.py
Normal file
11
tests/test_feed.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import json
|
||||
|
||||
from laya_router.feed import read_routes
|
||||
|
||||
|
||||
def test_read_routes_keeps_the_tail(tmp_path):
|
||||
path = tmp_path / "routes.jsonl"
|
||||
lines = [json.dumps({"ts": str(i), "level": "simple"}) for i in range(5)]
|
||||
path.write_text("\n".join(lines) + "\nbad\n", encoding="utf-8")
|
||||
records = read_routes(path, limit=2)
|
||||
assert [item["ts"] for item in records] == ["3", "4"]
|
||||
Reference in New Issue
Block a user