forked from ChelseaKR/tods-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_coverage_advisory.py
More file actions
33 lines (22 loc) · 1.19 KB
/
Copy pathtest_coverage_advisory.py
File metadata and controls
33 lines (22 loc) · 1.19 KB
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
30
31
32
33
"""Opt-in coverage (TODS-x5xx) and advisory (TODS-x6xx) rules."""
import pytest
from conftest import FIXTURES, VALID_GTFS, VALID_TODS, rule_ids
from tods_validate.runner import run
OPT_IN = ("TODS-I501", "TODS-I502", "TODS-I601")
_CATEGORIES = frozenset({"coverage", "advisory", "experimental"})
@pytest.mark.parametrize("rule_id", OPT_IN)
def test_opt_in_rule_silent_by_default(rule_id: str) -> None:
_, findings = run(FIXTURES / "invalid" / rule_id)
assert rule_id not in rule_ids(findings)
@pytest.mark.parametrize("rule_id", OPT_IN)
def test_opt_in_rule_fires_when_enabled(rule_id: str) -> None:
_, findings = run(FIXTURES / "invalid" / rule_id, enabled=_CATEGORIES)
assert rule_id in rule_ids(findings)
def test_enable_by_single_id() -> None:
_, findings = run(FIXTURES / "invalid" / "TODS-I601", enabled=frozenset({"TODS-I601"}))
assert "TODS-I601" in rule_ids(findings)
def test_opt_in_rules_silent_on_valid_feed_even_when_enabled() -> None:
# The valid feed has full coverage and breaks, so opt-in rules stay quiet.
_, findings = run(VALID_TODS, VALID_GTFS, enabled=_CATEGORIES)
for rule_id in OPT_IN:
assert rule_id not in rule_ids(findings), rule_id