test: expand config tests — BakeryConfig/LoraConfig __post_init__ coverage - #28
Conversation
ReviewGood comprehensive config test coverage — this is a strict superset of #15. The parametrized coercion tests and system_prompt_file tests are particularly valuable. Needs rebase: Now conflicts with main after #16 was merged (both modify |
…onfig post_init BakeryConfig.__post_init__: - remove_unused_columns always False - float string coercion for learning_rate, temperature, sampling_temperature, warmup_ratio, max_grad_norm - int string coercion for num_trajectories, trajectory_length, logging_steps, seed - invalid float/int strings raise ValueError with field name in message - native float values pass through unchanged - system_prompt loaded from file when system_prompt is None - system_prompt takes priority over system_prompt_file LoraConfig.__post_init__ target_modules normalization: - "all" string → "all-linear" - ["all"] list → "all-linear" - ["all-linear"] list → "all-linear" - "all-linear" string → unchanged - explicit module list → unchanged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
596b5d0 to
be52f7b
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
marksverdhei
left a comment
There was a problem hiding this comment.
Reviewed. Good restructuring into TestBakeryConfigPostInit and TestLoraConfigPostInit classes. The parametrized string coercion tests cover all float/int fields. Error path tests (invalid strings raising ValueError) and system_prompt_file priority logic are solid additions. Removes the old duplicate test_bakery_config_numeric_coercion. LGTM.
Summary
Expands
tests/test_config.pyfrom 2 tests to 22, adding thorough coverage for bothBakeryConfig.__post_init__andLoraConfig.__post_init__.New tests
TestBakeryConfigPostInitremove_unused_columnsis alwaysFalseregardless of what's passedlearning_rate,temperature,sampling_temperature,warmup_ratio,max_grad_norm) are coerced tofloat— mimicsHfArgumentParser.parse_yaml_filebehaviour where numeric values sometimes arrive as stringsnum_trajectories,trajectory_length,logging_steps,seed) are coerced tointValueErrorthat names the offending fieldfloatvalues pass through unchangedsystem_promptloaded fromsystem_prompt_filewhensystem_promptisNonesystem_prompttakes priority oversystem_prompt_fileTestLoraConfigPostInittarget_modules="all"normalised to"all-linear"target_modules=["all"]normalised to"all-linear"target_modules=["all-linear"]normalised to"all-linear"target_modules="all-linear"unchangedTest plan
All 22 tests pass (
uv run pytest tests/test_config.py).🤖 Generated with Claude Code