Skip to content

Commit 562ed55

Browse files
Strengthen from_partial drop-Nones test
The is-None assertions on max_tokens and seed weren't load-bearing: both fields default to None on a base RuntimeConfig, so the test would have passed even if from_partial forwarded the None kwargs. Added model_fields_set assertions, which carry only fields the caller explicitly set during construction, to prove the drop. Addresses CoPilot PR review feedback on #78.
1 parent 5baff12 commit 562ed55

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/unit/test_llm_provider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,12 @@ def test_runtime_config_from_partial_drops_nones() -> None:
476476

477477
assert config.temperature == 0.7
478478
assert config.top_p == 0.9
479+
# max_tokens and seed default to None on a base RuntimeConfig, so
480+
# `is None` alone doesn't prove the drop. model_fields_set carries
481+
# only explicitly-set fields, so its absence proves from_partial
482+
# filtered the None kwargs before __init__ ran.
483+
assert "max_tokens" not in config.model_fields_set
484+
assert "seed" not in config.model_fields_set
479485
assert config.max_tokens is None
480486
assert config.seed is None
481487

0 commit comments

Comments
 (0)