mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 22:27:01 +01:00
_challenge.py 467 -> 236. The two flows and run_coding_challenge go to _challenge_flows.py; the three static prompt strings to _challenge_prompts.py, which covered the last eleven lines after the first cut landed at 261. The 13 patch strings in test_challenge_part3.py were repointed per test, by which function is under test - the _run_user_impl tests keep _challenge. Getting that wrong does not fail here, it HANGS: an unintercepted _collect_and_rate_tests ran the real interactive flow and spun the suite for two minutes. Runs are now under an explicit timeout, and the patch targets are asserted to resolve before pytest starts. Pass count is 216 before and after. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
"""Static prompt and notice strings for the coding challenge.
|
|
|
|
Split out of :mod:`python_pkg.code_tutor._challenge` to keep it under the
|
|
250-line cap. These are pure data with no collaborators, so nothing patches
|
|
them and they can live anywhere.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
_NO_AI_NOTICE = (
|
|
"[bold yellow]⚠ No AI assistance -- write this yourself.[/bold yellow]\n"
|
|
"Your own explanation (and the tests below) are your only reference."
|
|
)
|
|
|
|
_MAX_TEST_ATTEMPTS = 2
|
|
|
|
_TEST_JUDGE_SYSTEM = (
|
|
"You are a code tutor evaluating whether a student's tests adequately"
|
|
" cover a function.\n\n"
|
|
"PASS if the tests:\n"
|
|
" - Include at least 2 meaningfully different test cases with distinct inputs\n"
|
|
" - Use assertions that verify the actual return value or observable behavior\n"
|
|
" - Would catch an obviously wrong implementation (e.g. one that always"
|
|
' returns "")\n\n'
|
|
"FAIL only if:\n"
|
|
" - There is only one trivial test case\n"
|
|
" - Assertions are always-true or don't check the function's real output\n"
|
|
" - All tests are essentially the same scenario with trivially different data\n\n"
|
|
"Do NOT require error/edge-case tests for pure transformation functions that"
|
|
" have no error handling. 2+ meaningful happy-path cases with distinct"
|
|
" inputs is enough.\n\n"
|
|
"Respond with valid JSON only, no other text:\n"
|
|
'{"verdict": "PASS" | "FAIL",'
|
|
' "gap": "<one sentence on the specific missing scenario,'
|
|
' or empty string on PASS>"}'
|
|
)
|