test_a_declared_key_is_observed_under_ingots_own_spellings¶
Tests › tests/test_datamodel.py
What this test is for
Why it exists
gh#42. THE JOIN MUST MATCH THE WAY INGOT MATCHES, or a declared key sits beside the identical observed key reading `observed = 0`. `filter.rs` accepts three spellings of one key, and its own comment says why the third exists::
Given
declared = "B12_BATTERY_STATE_OF_CHARGE"
When
observed_match(declared, frozenset({declared}))observed_match(declared, frozenset({f"DM_KEY_{declared}"}))observed_match(declared, frozenset({"B12BATTERYSTATEOFCHARGE"}))observed_match(declared, frozenset({"B12_BATTERY_VOLTAGE"}))
Then
- ✓ observed_match(declared, frozenset({declared})) holds
- ✓ observed_match(declared, frozenset({f"DM_KEY_{declared}"})) holds
- ✓ observed_match(declared, frozenset({"B12BATTERYSTATEOFCHARGE"})) holds
- ✓ observed_match(declared, frozenset({"B12_BATTERY_VOLTAGE"})) is false
tests/test_datamodel.py:1191 · its file's page
What it checks (4)
assert observed_match(declared, frozenset({declared})), "the bare spelling must match"observesobserved_matchassert observed_match(declared, frozenset({f"DM_KEY_{declared}"})), ( "ingot's generated key_definitions.h emits the DM_KEY_ form" )observesobserved_matchassert observed_match(declared, frozenset({"B12BATTERYSTATEOFCHARGE"})), ( "ingot normalizes by stripping underscores, so a YAML-era name still matches" )observesobserved_matchassert not observed_match(declared, frozenset({"B12_BATTERY_VOLTAGE"})), ( "a different key must not match, or every declared key would read as observed" )observesobserved_match
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-SCHEMA-013 measured