51 lines
2.2 KiB
Python
51 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Spezifikation: ein K-Poker-Tisch wird nicht als NLHE gespielt.
|
|
|
|
Belegt: `roomProperties.isKPoker` steht in jeder `game.game_alldata` (im Bestand immer false).
|
|
Nicht belegt: welche Taste welche Aktion und welchen Betrag auslöst - die Messvorlage
|
|
mock/vorlage/kpoker-tasten.md ist noch leer. Bis sie gefüllt ist:
|
|
|
|
* isKPoker true -> variant K_POKER, aussetzen (legalActions leer),
|
|
`_unklar` "K-Poker: Tastentabelle nicht gemessen"
|
|
* isKPoker false -> unverändert (NLHE aus miniGameTypeId 1)
|
|
* das Menü in `kpokerActions` (Annahme-Form des Klons) geht weiter vor: es nennt Aktionen und Größen
|
|
|
|
python3 tests/kpoker_tisch_spec.py -v
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import uebersetzung_spec as u # noqa: E402 (Zeilenbau: zeile, grund, zug)
|
|
|
|
|
|
def alldata(kpoker):
|
|
return u.zeile("game.game_alldata", {
|
|
"gameInitResponseData": {"bigBlind": 0.1, "gameHandId": None},
|
|
"seatInfoRsponseData": {"isGameStarted": False, "seatResponseDataList": []},
|
|
"roomProperties": {"gameType": "Ring", "miniGameTypeId": 1, "isKPoker": kpoker}})
|
|
|
|
|
|
class KPokerTisch(unittest.TestCase):
|
|
def test_kpoker_tisch_setzt_aus(self):
|
|
(a, _), = u.anfragen(alldata(True) + u.grund(u.FLOP) + u.zug())
|
|
self.assertEqual(a["variant"], "K_POKER")
|
|
self.assertEqual(a["legalActions"], [])
|
|
self.assertEqual(a["_unklar"], "K-Poker: Tastentabelle nicht gemessen")
|
|
|
|
def test_gewoehnlicher_tisch_bleibt(self):
|
|
(a, _), = u.anfragen(alldata(False) + u.grund(u.FLOP) + u.zug())
|
|
self.assertEqual((a["variant"], a["legalActions"]), ("NLHE", ["FOLD", "CALL", "RAISE"]))
|
|
self.assertNotIn("_unklar", a)
|
|
|
|
def test_menue_im_log_geht_vor(self):
|
|
menue = [{"action": "FOLD"}, {"action": "CALL", "amount": 0.4}, {"action": "RAISE", "amount": 1.2}]
|
|
(a, _), = u.anfragen(alldata(True) + u.grund(u.FLOP) + u.zug(kpokerActions=menue))
|
|
self.assertEqual((a["variant"], a["legalActions"], a["allowedSizes"]), ("K_POKER", ["FOLD", "CALL", "RAISE"], [1.2]))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|