Ebenfalls im Baum aufgetaucht: eine Tafel, welche Spielart ein Listeneintrag nennt (Feld und Name, mit Quelle), der Beleg zum Sitzen ueber den Kanal, und zwei leere Vergleichslogs. Spec gruen (24).
206 lines
9.3 KiB
Python
206 lines
9.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Die Inventar-Tafel der Spielarten (lesen/spielarten.py) - gegen woertliche Listeneintraege.
|
|
|
|
Beleg: die Eintraege unten sind woertlich aus der **allgemeinen** Lobby-Antwort des
|
|
Listing-Dienstes gezogen (`/get-lobby-list`, 03.11.2026, 171 Tische; die Bombpot-Eintraege aus
|
|
derselben Antwort mit `isBombpot:true`, 239 Tische). Gekuerzt nur um Felder, die hier nichts
|
|
tun; jeder Wert steht so im Dienst.
|
|
|
|
Die Tafel liest **Feld UND Name**, mit Quelle je Merkmal - wie tischregeln.tafel. Fehlt die
|
|
Quelle, fehlt das Merkmal; geraten wird nie.
|
|
|
|
python3 tests/spielarten_spec.py -v
|
|
"""
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
HIER = os.path.dirname(os.path.abspath(__file__))
|
|
WURZEL = os.path.dirname(HIER)
|
|
for p in (WURZEL, os.path.join(WURZEL, "lesen")):
|
|
if p not in sys.path:
|
|
sys.path.insert(0, p)
|
|
|
|
import spielarten
|
|
|
|
# ---- woertlich aus der allgemeinen Liste (Felder, die die Tafel liest) ----
|
|
SHORTDECK = {"roomName": "14R NL6 0.02 INRIT-(A) 1697833", "tableId": 1697833, "gameType": "Ring",
|
|
"gameVarient": "TexasSixPlus", "miniGameTypeId": 18, "tableSize": 6, "smallBlind": 0,
|
|
"bigBlind": 0.02, "ante": 0.02, "minBuyIn": 0.8, "maxBuyIn": 2,
|
|
"isRit": False, "iRitOptions": [0, 1, 2], "isEVChopAllowed": False}
|
|
PLO6 = {"roomName": "14R PLO6 0.01-0.02 EV-INRIT (A) 1703512", "tableId": 1703512,
|
|
"gameType": "Ring", "gameVarient": "6CardPLO", "miniGameTypeId": 20, "tableSize": 5,
|
|
"smallBlind": 0.01, "bigBlind": 0.02, "ante": 0, "minBuyIn": 0.8, "maxBuyIn": 2,
|
|
"isEVChopAllowed": True}
|
|
PLO5 = {"roomName": "14R PLO5 0.01-0.02 EV-INRIT (A) 1705797", "tableId": 1705797,
|
|
"gameType": "Ring", "gameVarient": "5CardPLO", "miniGameTypeId": 17, "tableSize": 6,
|
|
"smallBlind": 0.01, "bigBlind": 0.02, "ante": 0}
|
|
PLO4 = {"roomName": "14R PLO 0.01-0.02 EV-INRIT-ANTE (A) 1704989", "tableId": 1704989,
|
|
"gameType": "Ring", "gameVarient": "Omaha", "miniGameTypeId": 2, "tableSize": 6,
|
|
"smallBlind": 0.01, "bigBlind": 0.02, "ante": 0}
|
|
AOF_HOLDEM = {"roomName": "17th-TX AOF 0.10-0.25 232288", "tableId": 232288,
|
|
"gameType": "Allinfold", "gameVarient": "Holdem", "miniGameTypeId": 1, "tableSize": 4,
|
|
"smallBlind": 0.1, "bigBlind": 0.25, "ante": 0}
|
|
AOF_PLO4 = {"roomName": "26th-PLO4 AOF 0.10-0.25 232108", "tableId": 232108,
|
|
"gameType": "Allinfold", "gameVarient": "Omaha", "miniGameTypeId": 2, "tableSize": 4,
|
|
"smallBlind": 0.1, "bigBlind": 0.25, "ante": 0}
|
|
KPOKER = {"roomName": "KP-NL 0.10 EV-INRIT-(A) 7MAX 1704447", "tableId": 1704447,
|
|
"gameType": "Ring", "gameVarient": "Holdem", "miniGameTypeId": 1, "tableSize": 7,
|
|
"smallBlind": 0.1, "bigBlind": 0.1, "ante": 0.1, "isKPoker": True}
|
|
BOMBPOT = {"roomName": "PLO6 5-10-BPF-RC-TR (D) 1705855", "tableId": 1705855,
|
|
"gameType": "Ring", "gameVarient": "6CardPLO", "miniGameTypeId": 20, "tableSize": 5,
|
|
"smallBlind": 5, "bigBlind": 10, "ante": 0, "isBombpot": True,
|
|
"isFixedHandBombpot": True, "handsInBombpot": 1, "bombpotInducesDoubleBoard": True}
|
|
HU = {"roomName": "14R PLO HU 0.01-0.02 EV-INRIT-ANTE (A) 1702104", "tableId": 1702104,
|
|
"gameType": "Ring", "gameVarient": "Omaha", "miniGameTypeId": 2, "tableSize": 2,
|
|
"smallBlind": 0.01, "bigBlind": 0.02}
|
|
NOLIMP = {"roomName": "14R PLO 0.10-0.25 EV-INRIT-ANTE NOLP (A) 1696091", "tableId": 1696091,
|
|
"gameType": "Ring", "gameVarient": "Omaha", "miniGameTypeId": 2, "tableSize": 6,
|
|
"smallBlind": 0.1, "bigBlind": 0.25, "ante": 0.06, "isNoLimp": True}
|
|
|
|
|
|
class ArtAusDemFeld(unittest.TestCase):
|
|
"""Die Spielart kommt aus `gameVarient` und `miniGameTypeId` - beide sagen dasselbe."""
|
|
|
|
def test_shortdeck(self):
|
|
a = spielarten.art(SHORTDECK)
|
|
self.assertEqual(a["variante"], "TexasSixPlus")
|
|
self.assertEqual(a["kern"], "SHORT_DECK")
|
|
self.assertEqual(a["lochkarten"], 2)
|
|
self.assertEqual(a["quelle"], "beide") # Feld UND Name sagen es
|
|
|
|
def test_plo6_aus_feld(self):
|
|
a = spielarten.art(PLO6)
|
|
self.assertEqual((a["variante"], a["lochkarten"], a["kern"]), ("6CardPLO", 6, "PLO6"))
|
|
|
|
def test_plo5_aus_feld(self):
|
|
self.assertEqual(spielarten.art(PLO5)["lochkarten"], 5)
|
|
self.assertEqual(spielarten.art(PLO5)["kern"], "PLO5")
|
|
|
|
def test_omaha_ist_plo4(self):
|
|
a = spielarten.art(PLO4)
|
|
self.assertEqual((a["variante"], a["lochkarten"]), ("Omaha", 4))
|
|
|
|
def test_allinfold_traegt_die_basisart(self):
|
|
# Allinfold ist ein Zusatz, keine eigene Handart: TX -> Holdem, PLO4 -> Omaha
|
|
self.assertEqual(spielarten.art(AOF_HOLDEM)["variante"], "Holdem")
|
|
self.assertEqual(spielarten.art(AOF_PLO4)["variante"], "Omaha")
|
|
|
|
def test_nummer_allein_reicht(self):
|
|
self.assertEqual(spielarten.art({"miniGameTypeId": 18})["variante"], "TexasSixPlus")
|
|
self.assertEqual(spielarten.art({"gameVarient": "5CardPLO"})["variante"], "5CardPLO")
|
|
|
|
def test_unbekannte_nummer_ist_nichts(self):
|
|
self.assertIsNone(spielarten.art({}))
|
|
self.assertIsNone(spielarten.art({"miniGameTypeId": 99, "gameVarient": "Weird"}))
|
|
|
|
|
|
class ArtAusDemNamen(unittest.TestCase):
|
|
"""Ohne Felder traegt der Name: NL6, PLO5, PLO6, TX."""
|
|
|
|
def test_namensteile(self):
|
|
faelle = {"14R NL6 0.02 1697833": "TexasSixPlus", "14R PLO6 1-2 1705794": "6CardPLO",
|
|
"14R PLO5 5-10 1704157": "5CardPLO", "14R PLO 2-5 1703252": "Omaha",
|
|
"14R NL 0.5-1 1705866": "Holdem"}
|
|
for name, soll in faelle.items():
|
|
with self.subTest(name=name):
|
|
self.assertEqual(spielarten.art({"roomName": name}) ["variante"], soll)
|
|
|
|
def test_ohne_alles_nichts(self):
|
|
self.assertIsNone(spielarten.art({"roomName": "Big Ben 1665478"}))
|
|
|
|
|
|
class Widerspruch(unittest.TestCase):
|
|
"""Feld und Name duerfen sich widersprechen - das wird sichtbar, nicht geglaettet."""
|
|
|
|
def test_feld_schlaegt_name_und_merkt_den_widerspruch(self):
|
|
e = dict(PLO6, roomName="14R PLO5 1-2 1699845")
|
|
a = spielarten.art(e)
|
|
self.assertEqual(a["variante"], "6CardPLO") # Feld gilt
|
|
self.assertEqual(a["widerspruch"], "Omaha/PLO5") # Name sagt PLO5
|
|
|
|
|
|
class Format(unittest.TestCase):
|
|
"""Das Format (cash/aof/bombpot/kpoker) aus den Feldern UND aus dem Namen."""
|
|
|
|
def test_aof_aus_feld_und_name(self):
|
|
self.assertEqual(spielarten.format(AOF_HOLDEM), ("aof", "beide"))
|
|
|
|
def test_bombpot_aus_feld(self):
|
|
self.assertEqual(spielarten.format(BOMBPOT)[0], "bombpot")
|
|
|
|
def test_kpoker_aus_name(self):
|
|
self.assertEqual(spielarten.format(KPOKER), ("kpoker", "beide"))
|
|
|
|
def test_ring_ist_cash(self):
|
|
self.assertEqual(spielarten.format(PLO4), ("cash", "beide"))
|
|
|
|
|
|
class Tafel(unittest.TestCase):
|
|
"""Die Inventar-Tafel: Spielart, Deck, Rangfolge, Einsatz, Sitze, Blinds, Sonderfaelle."""
|
|
|
|
def test_shortdeck_tafel(self):
|
|
t = spielarten.tafel(SHORTDECK)
|
|
self.assertEqual(t["art"][0], "TexasSixPlus")
|
|
self.assertEqual(t["lochkarten"][0], 2)
|
|
self.assertEqual(t["deck"][0], 36) # Sechser-Deck
|
|
self.assertEqual(t["rangfolge"][0], "kurz") # Flush schlaegt Full House
|
|
self.assertEqual(t["einsatz"][0], "no_limit")
|
|
self.assertEqual(t["sitze"][0], 6)
|
|
self.assertEqual(t["ante"][0], 0.02)
|
|
self.assertEqual(t["blinds"][0], (0.0, 0.02))
|
|
self.assertEqual(t["buyin"][0], (0.8, 2.0))
|
|
|
|
def test_plo6_tafel_ist_pot_limit_und_sechs_karten(self):
|
|
t = spielarten.tafel(PLO6)
|
|
self.assertEqual(t["lochkarten"][0], 6)
|
|
self.assertEqual(t["einsatz"][0], "pot_limit")
|
|
self.assertEqual(t["deck"][0], 52)
|
|
self.assertEqual(t["rangfolge"][0], "standard")
|
|
|
|
def test_aof_ist_binary_und_hat_format(self):
|
|
t = spielarten.tafel(AOF_HOLDEM)
|
|
self.assertEqual(t["einsatz"][0], "binary")
|
|
self.assertEqual(t["format"][0], "aof")
|
|
|
|
def test_kpoker_hat_menue(self):
|
|
t = spielarten.tafel(KPOKER)
|
|
self.assertEqual(t["einsatz"][0], "menu")
|
|
self.assertEqual(t["format"][0], "kpoker")
|
|
self.assertEqual(t["max"][0], True) # 7MAX
|
|
|
|
def test_bombpot_tafel_nennt_doppelbrett_und_fix(self):
|
|
t = spielarten.tafel(BOMBPOT)
|
|
self.assertEqual(t["format"][0], "bombpot")
|
|
self.assertEqual(t["bombpot_fix"][0], True) # BPF
|
|
self.assertEqual(t["doppelbrett"][0], True)
|
|
|
|
def test_kopf_an_kopf_aus_sitzzahl_und_name(self):
|
|
t = spielarten.tafel(HU)
|
|
self.assertEqual(t["hu"][0], True)
|
|
self.assertEqual(t["hu"][1], "beide")
|
|
|
|
def test_kein_limp_und_ante_stehen_in_der_tafel(self):
|
|
t = spielarten.tafel(NOLIMP)
|
|
self.assertEqual(t["kein_limp"][0], True)
|
|
self.assertEqual(t["ante"][0], 0.06)
|
|
|
|
def test_quelle_ist_vermerkt(self):
|
|
t = spielarten.tafel(PLO4)
|
|
self.assertEqual(t["art"][1], "beide")
|
|
self.assertIn(t["ev_chop"][1], ("feld", "name", "beide"))
|
|
|
|
|
|
class Klartext(unittest.TestCase):
|
|
def test_ein_satz(self):
|
|
s = spielarten.klartext_tafel(spielarten.tafel(SHORTDECK))
|
|
self.assertIn("TexasSixPlus", s)
|
|
self.assertIn("kurz", s)
|
|
|
|
def test_leer_ist_standard(self):
|
|
self.assertEqual(spielarten.klartext_tafel({}), "Standardtisch")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|