Repository navigation
test(models): parametrize phantom-kwarg behavioral test across all Request models - #235
Conversation
…quest models Pairs with the existing config-level test_request_bodies_use_extra_forbid to verify behavior, not just configuration. Catches models where a contributor accidentally sets extra='allow' AND adds a typo'd field — the config test catches the first miss; this test catches the second. Closes #219 Refs #224
Code Review — PR #235Overall: Solid. The behavioral test is the right complement to the config-level gate. The auto-builder is clean and minimal. Two items worth addressing before merge, a few smaller nits. What the PR doesAdds a parametrized behavioral test ( Issues1. Meta-test ordering is inverted (minor correctness issue) The meta-test docstring says:
But in the file the meta-test is declared after
2. The walker handles primitives, # The walker handles primitives, ``Literal``, ``Union``/``Optional``,
# ``list[X]``, nested ``BaseModel`` subclasses, and ``UUID``. Enum,
# datetime, and other types must be supplied via ``_OVERRIDES``.Smaller nits
What's good
Fix the ordering issue and add the |
Wave 3-A of audit umbrella.
Pairs with the existing config-level
test_request_bodies_use_extra_forbidto verify behavior, not just configuration. For each of the 23 Request/RequestOrder models inkalshi.models.__all__, builds minimal-valid kwargs via a new auto-builder (tests/_request_model_fixtures.py) and assertspydantic.ValidationErrorwith anextra_forbiddenentry when a phantom field is passed.23 new parametrized cases + 1 meta-test. Catches the failure mode where a contributor flips
extra='allow'and adds a typo'd field — the config test catches the first miss; this test catches the second.Closes #219
Refs #224