| 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 | from store import Store |
| 9 | |
| 10 | s = Store() |
| 11 | s.set("Alpha", 1) |
| 12 | assert s.get("Alpha") == 1, "set/get must round-trip the same key" |
| 13 | s.set("beta", 2) |
| 14 | assert s.get("beta") == 2 |
| 15 | s.set("Alpha", 3) |
| 16 | assert s.get("Alpha") == 3, "overwrite must be visible" |
| 17 | assert len(s) == 2, "same key set twice must not duplicate" |
| 18 | s.delete("Alpha") |
| 19 | assert s.get("Alpha") is None, "delete must remove what set stored" |
| 20 | EOF |
| 21 |