Files
pokerfreak/tests/kanal_tat_spec.py
T
mmintel 9c79d8236b Acceptance 5.11.: channel play without AFK, quiet focus, working Cockpit, stronger play
- Practice tables: 20-min session 54/54 turns at the server, control session 28 turns,
  0 timeouts; stage: 3 tables, two rounds each, clean teardown.
- Never let the clock run: an engine abstention becomes check or fold (nie_verstreichen).
- Mittler join in a fixed order (kill the duplicate, then announce), a mittler ends with its
  game, the laufwache opens no tables, stop waits for the runner to stand up.
- Focus: no lobby connections from HUD, probes or layout; "Focus Window on Turn" off.
- Tables: disconnected or sitting-out opponents do not count; a table without channel is
  closed and avoided after 45 s; the join event keeps the writer's pid (strict invariants).
- Geldwache: same room list as the runner, the table's own report, stand up before closing.
- Engine: the small blind completes the top 65 % against limpers (price per fair share);
  the calling range of a bet is as wide as the villain calls - value bets into stations.
- Cockpit: the source tree never comes from SHELL; one operating set for laufwache and
  Cockpit (sicht/start.py --client, ServerStart).
- Project lives in ~/Projects/pokerfreak (kern was a detour).
2026-11-05 16:10:43 +01:00

64 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""Die Entscheidung geht ueber den Kanal als RICHTIGE ActionId (betrieb/runner._kanal_aktion).
Anlass (5.11., Abnahmelauf Big Ben 1716291): der Kanal nahm die Klick-Zuordnung `act.ZU_TAT`, in
der CHECK auf "call" zeigt - am Bildschirm sind Check und Call derselbe Knopf. Ueber den Kanal sind
es zwei Befehle (`PBCommon.TableEvents.Enums.ActionId`: Check 3, Call 4, Raise 5, AllIn 6,
Fold 7; archiv/mitschrieb/HANDELN.md). Jeder Check ging als Call raus, den der Server bei
"nichts zu zahlen" nicht anbietet - die Uhr lief ab, der Server checkte selbst, dann Sitout (AFK).
python3 tests/kanal_tat_spec.py -v
"""
import os
import sys
import unittest
HIER = os.path.dirname(os.path.abspath(__file__))
WURZEL = os.path.dirname(HIER)
for _u in ("betrieb", "hand", "client", "lesen", "entscheiden", "lobby", "mcp"):
_p = os.path.join(WURZEL, _u)
if _p not in sys.path:
sys.path.append(_p)
import runner # noqa: E402
import tischkanal # noqa: E402
class KanalTat(unittest.TestCase):
def setUp(self):
self.gesendet = []
self.alt = (runner.kanal_da, tischkanal.aktion, runner.ereignis)
runner.kanal_da = lambda raum: True
tischkanal.aktion = lambda raum, tat, betrag=None, frist=6.0: self.gesendet.append((tat, betrag)) or None
runner.ereignis = lambda art, **k: None
def tearDown(self):
runner.kanal_da, tischkanal.aktion, runner.ereignis = self.alt
def tat(self, antwort):
runner._kanal_aktion("Big Ben 1", antwort)
return self.gesendet[-1] if self.gesendet else None
def test_check_geht_als_check(self):
self.assertEqual(self.tat({"action": "CHECK"}), ("check", None))
def test_call_geht_als_call(self):
self.assertEqual(self.tat({"action": "CALL"}), ("call", None))
def test_raise_traegt_den_betrag(self):
self.assertEqual(self.tat({"action": "RAISE", "size": 4000}), ("raise", 4000))
def test_fold_geht_als_fold(self):
self.assertEqual(self.tat({"action": "FOLD"}), ("fold", None))
def test_allin_geht_als_allin(self):
self.assertEqual(self.tat({"action": "ALLIN"}), ("allin", None))
def test_die_namen_sind_die_actionids_des_clients(self):
self.assertEqual({t: tischkanal.ACTION_ID[t] for t in ("check", "call", "raise", "allin", "fold")},
{"check": 3, "call": 4, "raise": 5, "allin": 6, "fold": 7})
if __name__ == "__main__":
unittest.main(verbosity=2)