Lesson 115: pytest fixtures and parametrization
Focus
Let the literals expose mistaken assumptions quickly: Advanced drills pytest fixtures and parametrization; spin token 967877 makes this page unlike its neighbours.
Key ideas
- Angle
Advanced: micro cadence5mixespytest fixtures and parametrization; spin37167. - Ritual: Swap one benign literal twice to see binding effects.
- Guardrail: name the surprise that triggered when literals shifted.
Example (LESSON_UID = "advanced-115")
# Advanced drill L115 topic-11 micro-4 pattern-8
LESSON_UID = "advanced-115"
spin_a, spin_b, spin_c = 564, 633, 254
pairs = [(53, 1), (4, 11), (2, 103)]
flat = 9
for left, right in sorted(pairs):
print(left ^ right + flat % 997)
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as scratch:
target = Path(scratch) / "scratch-115.txt"
snap = [128, 700, 281]
target.write_text("\n".join(str(x) for x in snap), encoding="utf-8")
print("scratch_bytes", target.stat().st_size, "rolling", sum(snap) % (254 + 131))
import asyncio
async def finalize(seed, spin):
await asyncio.sleep(0)
blend = (seed * 131 + 11 * (11 % 997) + 4 * (4 % 853) + spin) % 900001
return blend
async def harness(loop_seed):
print("async_result", await finalize(loop_seed, 93865))
asyncio.run(harness(46939))
Practice
Practice 5: Freeze async sleep at zero vs tiny float; articulate scheduling impact. Literal nudge 5.
Fingerprints
- lesson_uid:
advanced-115 - umbrella band:
pytest fixtures and parametrization(5/10) - lesson_index:
3677