1 Testing
1.1 Running tests
python3 -m pytest -v # All tests
python3 -m pytest tests/test_casino_chips.py -v
python3 -m pytest -k navigation -v1.2 Test structure
| File | Coverage |
|---|---|
test_cards.py |
Shoe, shuffle, dealing |
test_hand.py |
Hand valuation |
test_rules.py |
Blackjack rules, payouts |
test_table.py |
End-to-end blackjack round |
test_casino_chips.py |
ChipWallet, session stats |
test_casino_activities.py |
Slots paytable, registry |
test_sportsbook.py |
Odds calculation, spread resolution |
test_casino_navigation.py |
Hub menus, help, cashier |
1.3 Deterministic RNG in tests
Blackjack tests inject a seeded RNG:
class SeededRandom:
def __init__(self, seed: int) -> None:
self._rng = random.Random(seed)
def randrange(self, start: int, stop: int) -> int:
return self._rng.randrange(start, stop)Production code always uses secrets.SystemRandom().
1.5 Writing new tests
- Prefer unit tests for pure logic (payouts, odds, hand values)
- Use scripted I/O for menu navigation
- Keep tests fast — no network, no filesystem side effects
- Run the full suite before committing