| 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 utils import head, tail, chunk |
| 9 | |
| 10 | assert tail([1, 2, 3], 2) == [2, 3], tail([1, 2, 3], 2) |
| 11 | assert tail([1, 2, 3], 1) == [3], tail([1, 2, 3], 1) |
| 12 | assert tail([7], 1) == [7], tail([7], 1) |
| 13 | assert tail([1, 2], 5) == [1, 2], tail([1, 2], 5) |
| 14 | assert tail([1, 2, 3], 0) == [] |
| 15 | assert head([1, 2, 3], 2) == [1, 2] |
| 16 | assert chunk([1, 2, 3, 4], 2) == [[1, 2], [3, 4]] |
| 17 | EOF |
| 18 |