Test fixture
Code transformation while preserving behavior and intent.
The model receives the prompt (and optional system message). The run uses scorer contains_all with the JSON configuration below. Pass/fail and partial credit are determined entirely by that scorer against the model output; no human grading.
Refactor without changing behavior. Return only Python code.
def can_access(user, resource):
if user is None:
return False
if resource is None:
return False
if user.get("disabled"):
return False
if resource.get("archived"):
return False
if user.get("role") == "admin":
return True
if user.get("team") == resource.get("team") and resource.get("visibility") == "team":
return True
return False
{
"expected_contains": [
"if not user",
"if not resource",
"user.get(\"role\") == \"admin\""
]
}temperature
0
max_tokens
260
timeout (s)
120
type
scored
file
refactoring_medium_05.json