forked from ChelseaKR/tods-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_valid_feed.py
More file actions
29 lines (20 loc) · 990 Bytes
/
Copy pathtest_valid_feed.py
File metadata and controls
29 lines (20 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""The valid fixture feed must be completely clean, however it is loaded."""
from conftest import VALID_GTFS, VALID_TODS
from tods_validate.findings import Finding
from tods_validate.runner import run
def _describe(findings: list[Finding]) -> str:
return "\n".join(f"{f.rule_id}: {f.message}" for f in findings)
def test_valid_feed_with_gtfs_flag(valid_findings: list[Finding]) -> None:
assert valid_findings == [], _describe(valid_findings)
def test_valid_feed_without_gtfs() -> None:
_, findings = run(VALID_TODS)
assert findings == [], _describe(findings)
def test_valid_feed_combined_directory(tmp_path) -> None:
"""TODS and GTFS files shipped together validate against each other."""
combined = tmp_path / "feed"
combined.mkdir()
for source in (VALID_GTFS, VALID_TODS):
for f in source.iterdir():
(combined / f.name).write_bytes(f.read_bytes())
_, findings = run(combined)
assert findings == [], _describe(findings)