Skip to content

test(core): exercise the source decorator's normalizer parameter - #319

Merged
aaaaahaaaaa merged 1 commit into
mainfrom
fix/source-decorator-normalizer-untested
Sep 4, 2026
Merged

test(core): exercise the source decorator's normalizer parameter#319
aaaaahaaaaa merged 1 commit into
mainfrom
fix/source-decorator-normalizer-untested

Conversation

@aaaaahaaaaa

Copy link
Copy Markdown
Contributor

The workspace's only two skipped tests were both this suite refusing to test one decorator parameter. Zero skips now (2535 passed, 0 skipped).

What the skips were hiding

tests/source/test_decorator.py exercises the whole advertised @il.source(...) surface generically: for each keyword parameter, build a source with it and assert the class builds — "a routed name with no matching field crashes at build". A per-parameter sample value drives it.

normalizer's sample value was None, and both tests skipped on it:

if value is None:
    pytest.skip(f"{param} has no non-None sample value")

That skip could never have been satisfiable: the decorator's _split_params drops None-valued parameters before they reach the built class, so a None sample would exercise nothing even if it ran. The effect was that normalizer — one of the ten advertised parameters — was the one the suite never checked, while reading as if it did.

The fix

The parameter works fine. A real Normalizer() routes through both the function and the class form and lands as the built class's field default:

function form ok: True   normalizer on instance: Normalizer
class form ok: True      normalizer on instance: Normalizer

So the sample value becomes a real normalizer and both skips go. The full surface is now genuinely exercised rather than nine tenths of it.

Guarding the regression

A None sample value would silently reopen the hole — the parametrized test would pass while testing nothing — so that's now an assertion rather than a skip:

def test_no_sample_value_is_none(self):
    """A None value is skipped by the decorator, so it would prove nothing."""
    assert [name for name, value in PARAM_VALUES.items() if value is None] == []

Verified it bites: putting None back fails that test rather than quietly skipping.

Verification

uv run ruff check, uv run ty check and the full workspace suite all green — 2535 passed, 0 skipped (was 2533 passed, 2 skipped). Pre-commit ran the same three hooks on the commit.

By Digitl

The two skipped tests in the workspace were both this suite refusing to
test `@il.source(normalizer=...)`: its sample value was `None`, and a
`None`-valued parameter is dropped by `_split_params` before it reaches
the built class, so the skip existed because the value could never have
proved anything.

The parameter works — a real `Normalizer()` routes through both the
function and the class form and lands as the built class's field default.
So the sample value becomes a real normalizer, the two skips go, and the
whole advertised decorator surface is now genuinely exercised rather than
nine tenths of it.

A `None` sample value would silently reintroduce the hole (the test would
pass while testing nothing), so it is now an assertion of its own rather
than a skip.

By Digitl
@aaaaahaaaaa
aaaaahaaaaa merged commit 3263f14 into main Sep 4, 2026
11 checks passed
@aaaaahaaaaa
aaaaahaaaaa deleted the fix/source-decorator-normalizer-untested branch September 4, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant