31 lines
805 B
Python
31 lines
805 B
Python
import unittest
|
|
|
|
from texas_holdem.service import GameManager
|
|
|
|
|
|
class ServiceTests(unittest.TestCase):
|
|
def test_create_and_run_game(self) -> None:
|
|
manager = GameManager()
|
|
game = manager.create_game(
|
|
{
|
|
"game_id": "demo",
|
|
"seed": 11,
|
|
"starting_stack": 200,
|
|
"small_blind": 5,
|
|
"big_blind": 10,
|
|
"players": [
|
|
{"id": "a", "type": "calling"},
|
|
{"id": "b", "type": "calling"},
|
|
],
|
|
}
|
|
)
|
|
|
|
hands = manager.run_hands(game.game_id, count=1)
|
|
|
|
self.assertEqual(len(hands), 1)
|
|
self.assertEqual(manager.get_game("demo").to_dict()["hand_number"], 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|