"""合成零结果诊断:每次只放宽一个条件。""" import json rows = [{"symbol": "AAA", "pe": 18, "growth": .08}, {"symbol": "BBB", "pe": 24, "growth": .15}, {"symbol": "CCC", "pe": 30, "growth": None}] def screen(pe_limit=20, growth_floor=.10): return [r["symbol"] for r in rows if r["growth"] is not None and r["pe"] < pe_limit and r["growth"] >= growth_floor] baseline = screen() proposals = {"pe_lt_25": screen(pe_limit=25), "growth_ge_0.05": screen(growth_floor=.05)} assert baseline == [] assert proposals == {"pe_lt_25": ["BBB"], "growth_ge_0.05": ["AAA"]} assert screen(growth_floor=10) == [] assert sum(r["growth"] is None for r in rows) == 1 assert screen() == baseline print(json.dumps({"baseline": baseline, "relax_one": proposals, "growth_coverage": "2/3", "unit_error_floor": 10}))