from market_agents.experiments.config import RunConfig def test_leaf_dict_overrides_replace_and_sections_merge(): cfg = RunConfig() t = cfg.with_overrides(**{"population.llm.provider_mix": {"openai": 1.0}, "population.llm_share": 0.25, "exchange.halt_threshold": 0.05}) assert t.population.llm.provider_mix == {"openai": 1.0} assert t.population.llm_share == 0.25 and t.exchange.halt_threshold == 0.05 assert t.exchange.taker_fee_bps == cfg.exchange.taker_fee_bps # section merge keeps the rest t2 = cfg.with_overrides(population={"mix": {"market_maker": 1.0}, "activity": {"market_maker": 0.0}}) assert t2.population.mix == {"market_maker": 1.0}