返回 DeepSeek-Reasonix
verify.sh
1 #!/usr/bin/env bash
2 set -e
3 # Fresh bytecode cache: macOS system Python caches centrally (pycache_prefix),
4 # where a same-size same-second edit is invisible; a throwaway prefix defeats it.
5 export PYTHONPYCACHEPREFIX="$(mktemp -d)"
6 find . -name '__pycache__' -type d -prune -exec rm -rf {} +
7 python3 - <<'EOF'
8 import inspect
9
10 import limits
11 import quota
12 import uploader
13
14 assert limits.MAX_RETRIES == 3
15 assert limits.MAX_UPLOAD_BYTES == 8_388_608
16
17 assert quota.attempts_left(0) == 3
18 assert quota.attempts_left(2) == 1
19 assert quota.attempts_left(9) == 0
20 assert quota.upload_allowed(8_388_608)
21 assert not quota.upload_allowed(8_388_609)
22 assert not quota.upload_allowed(0)
23
24 assert uploader.plan_upload(1) == {"chunks": 1, "retries": 3, "rejected": False}
25 assert uploader.plan_upload(2_097_153)["chunks"] == 3
26 assert uploader.plan_upload(8_388_609) == {"chunks": 0, "retries": 0, "rejected": True}
27
28 for mod in (quota, uploader):
29 src = inspect.getsource(mod)
30 assert "limits" in src, f"{mod.__name__} must read from limits.py"
31 assert "8_388_608" not in src and "8388608" not in src, f"magic size still hardcoded in {mod.__name__}"
32 EOF
33
33 lines BASH