Spaces:
Sleeping
Sleeping
Strengthen test generation prompt diversity
Browse filesFiles changed (2)
96 unmodified lines9798991001011021031041107 unmodified lines1212121312141213121412151216121712181219122096 unmodified lines- Prefer inputs that make multi-step behavioral mistakes visible rather than cosmetic differences.
DIVERSITY REQUIREMENTS:- Generate cases from at least 4 different input-shape families, not 4 variations of the same shape.- Include one simple happy-path case, one boundary/empty case, one mixed or longer-input case, and one unusual-but-valid case.- All {target_test_count} test cases must be DISTINCT. Do not repeat the same args.- Avoid near-duplicate tests that only change one number while keeping the same overall shape.- Vary both the VALUES and the STRUCTURE of inputs whenever the function allows it.1107 unmodified lines f"{len(unique_args)} unique argument tuples, and {len(diversity_signatures)} " f"input-shape patterns; the validator requires at least {required_patterns} " f"patterns and {minimum_unique_count} unique tuples. " f"Return valid JSON with at least {minimum_test_count} supported tests and do not repeat the " "previous arguments." f"This retry must cover at least 4 different input-shape families: " "a simple happy path, an empty or boundary case, a longer or mixed case, " "and an unusual-but-valid case. Do not repeat the previous arguments." ) except json.JSONDecodeError as e:528 unmodified lines52953053153253353453546 unmodified lines582583584585586587588528 unmodified lines retry_messages = llm.invoke.call_args_list[1].args[0] assert "Use input collections too." in first_messages[0].content assert "10 supported tests" in retry_messages[1].content assert "at least 4 different input-shape families" in retry_messages[1].content
def test_test_generation_never_retries_more_than_twice():46 unmodified lines system_prompt = llm.invoke.call_args.args[0][0].content assert "EXACTLY 16 test cases" in system_prompt assert "EXACTLY 25" not in system_prompt assert "at least 4 different input-shape families" in llm.invoke.call_args_list[0].args[0][0].content assert messages[0] == "Generating test candidates (attempt 1/2)" assert "Checking test response" in messages[1] assert messages[-1] == "Accepted 16 candidate tests"architect/saboteur.py+5-2
test_saboteur_generated_test_validation.py+2