Spaces:
Sleeping
Sleeping
Download tests/test_exercise_eval.py from baljot07/studiq-backend: direct link, hf CLI and curl.
- Browser
- Download file 479 Bytes
-
https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_exercise_eval.py
- Command line
-
hf download hf://spaces/baljot07/studiq-backend/tests/test_exercise_eval.py
-
curl -L -o test_exercise_eval.py https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_exercise_eval.py
479 Bytes
| """Unit tests for programming challenge test-case evaluation logic.""" | |
| import pytest | |
| def test_exercise_testcase_scoring(): | |
| """Verify test-case pass rate calculations.""" | |
| def calculate_score(passed: int, total: int, max_xp: int = 20) -> int: | |
| if total == 0: | |
| return 0 | |
| ratio = passed / total | |
| return int(ratio * max_xp) | |
| assert calculate_score(5, 5) == 20 | |
| assert calculate_score(2, 4) == 10 | |
| assert calculate_score(0, 5) == 0 | |