test_substrate_capability.py¶
tests/test_substrate_capability.py
What the substrate can parse is a measurement, never a version comparison.
test_a_language_the_substrate_does_not_have_is_absent
None test_substrate_capability.test_a_language_the_substrate_does_not_have_is_absent()
A negative, so the set is not merely non-empty.
tests/test_substrate_capability.py:51
Checks
assert not substrate.has_language("cobol")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_a_language_the_substrate_does_not_have_is_absent → has_language |
Source · 5 lines
def test_a_language_the_substrate_does_not_have_is_absent() -> None:
"""@brief A negative, so the set is not merely non-empty. @version 1"""
assert not substrate.has_language("cobol")
Activity · 1 steps
test_an_unimportable_substrate_degrades_rather_than_raising
None test_substrate_capability.test_an_unimportable_substrate_degrades_rather_than_raising(pytest.MonkeyPatch monkeypatch)
No substrate means no languages, not an exception.
tests/test_substrate_capability.py:78
Checks
assert substrate.compiled_languages() == frozenset()assert not substrate.has_language("c")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_an_unimportable_substrate_degrades_rather_than_raising → compiled_languages |
Source · 15 lines
def test_an_unimportable_substrate_degrades_rather_than_raising(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""The substrate is a hard dependency, so this should not happen — but the gate is
consulted on the gate's path too, and a front end that cannot run must say so rather
than take the build down.
@brief No substrate means no languages, not an exception. @version 1
"""
monkeypatch.setitem(sys.modules, "lang_parsing_substrate", None)
substrate.compiled_languages.cache_clear()
assert substrate.compiled_languages() == frozenset()
assert not substrate.has_language("c")
Activity · 4 steps
test_missing_languages_is_empty_when_everything_asked_for_is_present
None test_substrate_capability.test_missing_languages_is_empty_when_everything_asked_for_is_present()
The empty answer is the one a front end acts on.
tests/test_substrate_capability.py:73
Checks
assert substrate.missing_languages(_ALWAYS) == ()
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_missing_languages_is_empty_when_everything_asked_for_is_present → missing_languages |
Source · 5 lines
def test_missing_languages_is_empty_when_everything_asked_for_is_present() -> None:
"""@brief The empty answer is the one a front end acts on. @version 1"""
assert substrate.missing_languages(_ALWAYS) == ()
Activity · 1 steps
test_the_gate_is_capability_not_version
None test_substrate_capability.test_the_gate_is_capability_not_version(pytest.MonkeyPatch monkeypatch)
Version 0.12.0 with no bash means has_language('bash') is False.
tests/test_substrate_capability.py:56
Checks
assert substrate.has_language("c")assert not substrate.has_language("bash")assert substrate.missing_languages(("c", "bash", "cmake")) == ("bash", "cmake")
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_the_gate_is_capability_not_version → has_language |
Source · 17 lines
def test_the_gate_is_capability_not_version(monkeypatch: pytest.MonkeyPatch) -> None:
"""A stand-in carrying a version that publishes bash while reporting a language set
without it is the state a wheel built with fewer cargo features leaves behind.
@brief Version 0.12.0 with no bash means has_language('bash') is False. @version 2
"""
fake = types.ModuleType("lang_parsing_substrate")
fake.__version__ = "0.12.0"
fake.languages = lambda: [types.SimpleNamespace(key=k) for k in _ALWAYS]
monkeypatch.setitem(sys.modules, "lang_parsing_substrate", fake)
substrate.compiled_languages.cache_clear()
assert substrate.has_language("c")
assert not substrate.has_language("bash")
assert substrate.missing_languages(("c", "bash", "cmake")) == ("bash", "cmake")
Activity · 8 steps
test_the_languages_the_substrate_has_always_had_are_reported
None test_substrate_capability.test_the_languages_the_substrate_has_always_had_are_reported()
The gate reads the real module.
tests/test_substrate_capability.py:43
Checks
assert isinstance(keys, frozenset)assert key in keys, f"{key} absent from a substrate that must have it: {sorted(keys)}"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_the_languages_the_substrate_has_always_had_are_reported → compiled_languages |
Source · 8 lines
def test_the_languages_the_substrate_has_always_had_are_reported() -> None:
"""@brief The gate reads the real module. @version 1"""
keys = substrate.compiled_languages()
assert isinstance(keys, frozenset)
for key in _ALWAYS:
assert key in keys, f"{key} absent from a substrate that must have it: {sorted(keys)}"
Activity · 4 steps
test_the_required_substrate_has_the_configuration_languages
None test_substrate_capability.test_the_required_substrate_has_the_configuration_languages()
The installed wheel carries all five configuration grammars.
tests/test_substrate_capability.py:93
Checks
assert not missing, f"lang-parsing-substrate>=0.12.0 is required; absent: {missing}"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-PIPE-012 | measured | test_the_required_substrate_has_the_configuration_languages → missing_languages |
Source · 9 lines
def test_the_required_substrate_has_the_configuration_languages() -> None:
"""Not a property of clew — a check that THIS venv's wheel meets the dependency floor,
so the front-end tests that skip on a missing grammar are exercising real grammars
rather than skipping in silence.
@brief The installed wheel carries all five configuration grammars. @version 2
"""
missing = substrate.missing_languages(_CONFIGURATION)
assert not missing, f"lang-parsing-substrate>=0.12.0 is required; absent: {missing}"1 more lines, not shown