Skip to content

Commit 9e399c4

Browse files
committed
remove use of poker.efg in test suite
1 parent d96f877 commit 9e399c4

4 files changed

Lines changed: 26 additions & 45 deletions

File tree

tests/games.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ def create_mixed_behav_game_efg() -> gbt.Game:
113113
return read_from_file("mixed_behavior_game.efg")
114114

115115

116-
def create_1_card_poker_efg() -> gbt.Game:
117-
"""
118-
Returns
119-
-------
120-
Game
121-
One-card two-player poker game, as used in the user guide
122-
"""
123-
return read_from_file("poker.efg")
124-
125-
126116
def create_myerson_2_card_poker_efg() -> gbt.Game:
127117
"""
128118
Returns

tests/test_extensive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_game_add_players_nolabel():
5454
("e01.efg", True),
5555
("e02.efg", True),
5656
("cent3.efg", True),
57-
("poker.efg", True),
57+
("myerson_2_card_poker.efg", True),
5858
("basic_extensive_game.efg", True),
5959
6060
# Games with perfect recall from generated games (game_input is a gbt.Game object)

tests/test_nash.py

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@
1919

2020
def test_enumpure_strategy():
2121
"""Test calls of enumeration of pure strategies."""
22-
game = games.read_from_file("poker.efg")
22+
game = games.read_from_file("myerson_2_card_poker.efg")
2323
assert len(gbt.nash.enumpure_solve(game, use_strategic=True).equilibria) == 0
2424

2525

2626
def test_enumpure_agent():
2727
"""Test calls of enumeration of pure agent strategies."""
28-
game = games.read_from_file("poker.efg")
28+
game = games.read_from_file("myerson_2_card_poker.efg")
2929
assert len(gbt.nash.enumpure_solve(game, use_strategic=False).equilibria) == 0
3030

3131

3232
def test_enummixed_double():
3333
"""Test calls of enumeration of mixed strategy equilibria for 2-player games, floating-point.
3434
"""
35-
game = games.read_from_file("poker.efg")
35+
game = games.read_from_file("myerson_2_card_poker.efg")
3636
result = gbt.nash.enummixed_solve(game, rational=False)
3737
assert len(result.equilibria) == 1
3838
# For floating-point results are not exact, so we skip testing exact values for now
@@ -44,7 +44,6 @@ def test_enummixed_double():
4444
"game,mixed_strategy_prof_data",
4545
[
4646
# Zero-sum games
47-
(games.create_1_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]]),
4847
(games.create_myerson_2_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]]),
4948
# Non-zero-sum games
5049
(games.create_one_shot_trust_efg(), [[[0, 1], ["1/2", "1/2"]],
@@ -90,11 +89,6 @@ def test_enummixed_rational(game: gbt.Game, mixed_strategy_prof_data: list):
9089
"game,mixed_behav_prof_data,stop_after",
9190
[
9291
# 2-player zero-sum games
93-
(
94-
games.create_1_card_poker_efg(),
95-
[[[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]],
96-
None,
97-
),
9892
(
9993
games.create_myerson_2_card_poker_efg(),
10094
[[[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]],
@@ -240,7 +234,7 @@ def are_the_same(game, found, candidate):
240234

241235
def test_lcp_strategy_double():
242236
"""Test calls of LCP for mixed strategy equilibria, floating-point."""
243-
game = games.read_from_file("poker.efg")
237+
game = games.read_from_file("myerson_2_card_poker.efg")
244238
result = gbt.nash.lcp_solve(game, use_strategic=True, rational=False)
245239
assert len(result.equilibria) == 1
246240
# For floating-point results are not exact, so we skip testing exact values for now
@@ -252,7 +246,6 @@ def test_lcp_strategy_double():
252246
"game,mixed_strategy_prof_data,stop_after",
253247
[
254248
# Zero-sum games
255-
(games.create_1_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None),
256249
(games.create_myerson_2_card_poker_efg(), [[["1/3", "2/3", 0, 0], ["2/3", "1/3"]]], None),
257250
(games.create_kuhn_poker_efg(), [games.kuhn_poker_lcp_first_mixed_strategy_prof()], 1),
258251
# Non-zero-sum games
@@ -311,7 +304,7 @@ def test_lcp_strategy_rational(game: gbt.Game, mixed_strategy_prof_data: list,
311304

312305
def test_lcp_behavior_double():
313306
"""Test calls of LCP for mixed behavior equilibria, floating-point."""
314-
game = games.read_from_file("poker.efg")
307+
game = games.read_from_file("myerson_2_card_poker.efg")
315308
result = gbt.nash.lcp_solve(game, use_strategic=False, rational=False)
316309
assert len(result.equilibria) == 1
317310
# For floating-point results are not exact, so we skip testing exact values for now
@@ -323,7 +316,6 @@ def test_lcp_behavior_double():
323316
"game,mixed_behav_prof_data",
324317
[
325318
# Zero-sum games (also tested with lp solve)
326-
(games.create_1_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]),
327319
(games.create_myerson_2_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]),
328320
(
329321
games.create_kuhn_poker_efg(),
@@ -380,7 +372,7 @@ def test_lcp_behavior_rational(game: gbt.Game, mixed_behav_prof_data: list):
380372

381373
def test_lp_strategy_double():
382374
"""Test calls of LP for mixed strategy equilibria, floating-point."""
383-
game = games.read_from_file("poker.efg")
375+
game = games.read_from_file("myerson_2_card_poker.efg")
384376
result = gbt.nash.lp_solve(game, use_strategic=True, rational=False)
385377
assert len(result.equilibria) == 1
386378
# For floating-point results are not exact, so we skip testing exact values for now
@@ -390,7 +382,7 @@ def test_lp_strategy_double():
390382
@pytest.mark.nash_lp_strategy
391383
def test_lp_strategy_rational():
392384
"""Test calls of LP for mixed strategy equilibria, rational precision."""
393-
game = games.read_from_file("poker.efg")
385+
game = games.read_from_file("myerson_2_card_poker.efg")
394386
result = gbt.nash.lp_solve(game, use_strategic=True, rational=True)
395387
assert len(result.equilibria) == 1
396388
expected = game.mixed_strategy_profile(
@@ -405,7 +397,7 @@ def test_lp_strategy_rational():
405397

406398
def test_lp_behavior_double():
407399
"""Test calls of LP for mixed behavior equilibria, floating-point."""
408-
game = games.read_from_file("poker.efg")
400+
game = games.read_from_file("myerson_2_card_poker.efg")
409401
result = gbt.nash.lp_solve(game, use_strategic=False, rational=False)
410402
assert len(result.equilibria) == 1
411403
# For floating-point results are not exact, so we skip testing exact values for now
@@ -420,7 +412,6 @@ def test_lp_behavior_double():
420412
games.create_two_player_perfect_info_win_lose_efg(),
421413
[[[0, 1], [1, 0]], [[1, 0], [1, 0]]],
422414
),
423-
(games.create_1_card_poker_efg(), [[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]]),
424415
(
425416
games.create_myerson_2_card_poker_efg(),
426417
[[[1, 0], ["1/3", "2/3"]], [["2/3", "1/3"]]],
@@ -456,47 +447,47 @@ def test_lp_behavior_rational(game: gbt.Game, mixed_behav_prof_data: list):
456447

457448
def test_liap_strategy():
458449
"""Test calls of liap for mixed strategy equilibria."""
459-
game = games.read_from_file("poker.efg")
450+
game = games.read_from_file("myerson_2_card_poker.efg")
460451
_ = gbt.nash.liap_solve(game.mixed_strategy_profile())
461452

462453

463454
def test_liap_behavior():
464455
"""Test calls of liap for mixed behavior equilibria."""
465-
game = games.read_from_file("poker.efg")
456+
game = games.read_from_file("myerson_2_card_poker.efg")
466457
_ = gbt.nash.liap_solve(game.mixed_behavior_profile())
467458

468459

469460
def test_simpdiv_strategy():
470461
"""Test calls of simplicial subdivision for mixed strategy equilibria."""
471-
game = games.read_from_file("poker.efg")
462+
game = games.read_from_file("myerson_2_card_poker.efg")
472463
result = gbt.nash.simpdiv_solve(game.mixed_strategy_profile(rational=True))
473464
assert len(result.equilibria) == 1
474465

475466

476467
def test_ipa_strategy():
477468
"""Test calls of IPA for mixed strategy equilibria."""
478-
game = games.read_from_file("poker.efg")
469+
game = games.read_from_file("myerson_2_card_poker.efg")
479470
result = gbt.nash.ipa_solve(game)
480471
assert len(result.equilibria) == 1
481472

482473

483474
def test_gnm_strategy():
484475
"""Test calls of GNM for mixed strategy equilibria."""
485-
game = games.read_from_file("poker.efg")
476+
game = games.read_from_file("myerson_2_card_poker.efg")
486477
result = gbt.nash.gnm_solve(game)
487478
assert len(result.equilibria) == 1
488479

489480

490481
def test_logit_strategy():
491482
"""Test calls of logit for mixed strategy equilibria."""
492-
game = games.read_from_file("poker.efg")
483+
game = games.read_from_file("myerson_2_card_poker.efg")
493484
result = gbt.nash.logit_solve(game, use_strategic=True)
494485
assert len(result.equilibria) == 1
495486

496487

497488
def test_logit_behavior():
498489
"""Test calls of logit for behavior equilibria."""
499-
game = games.read_from_file("poker.efg")
490+
game = games.read_from_file("myerson_2_card_poker.efg")
500491
result = gbt.nash.logit_solve(game, use_strategic=False)
501492
assert len(result.equilibria) == 1
502493

tests/test_node.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -791,26 +791,26 @@ def test_node_plays():
791791

792792

793793
def test_node_children_action_label():
794-
game = games.read_from_file("poker.efg")
795-
assert game.root.children["Red"] == game.root.children[0]
796-
assert game.root.children["Black"].children["Fold"] == game.root.children[1].children[1]
794+
game = games.read_from_file("myerson_2_card_poker.efg")
795+
assert game.root.children["RED"] == game.root.children[0]
796+
assert game.root.children["BLACK"].children["FOLD"] == game.root.children[1].children[1]
797797

798798

799799
def test_node_children_action():
800-
game = games.read_from_file("poker.efg")
801-
assert game.root.children[game.root.infoset.actions["Red"]] == game.root.children[0]
800+
game = games.read_from_file("myerson_2_card_poker.efg")
801+
assert game.root.children[game.root.infoset.actions["RED"]] == game.root.children[0]
802802

803803

804804
def test_node_children_nonexistent_action():
805-
game = games.read_from_file("poker.efg")
805+
game = games.read_from_file("myerson_2_card_poker.efg")
806806
with pytest.raises(ValueError):
807-
_ = game.root.children["Green"]
807+
_ = game.root.children["GREEN"]
808808

809809

810810
def test_node_children_other_infoset_action():
811-
game = games.read_from_file("poker.efg")
811+
game = games.read_from_file("myerson_2_card_poker.efg")
812812
with pytest.raises(ValueError):
813-
_ = game.root.children[game.root.children[0].infoset.actions["Raise"]]
813+
_ = game.root.children[game.root.children[0].infoset.actions["RAISE"]]
814814

815815

816816
@pytest.mark.parametrize(
@@ -821,7 +821,7 @@ def test_node_children_other_infoset_action():
821821
pytest.param(games.read_from_file("cent3.efg")),
822822
pytest.param(games.read_from_file("e01.efg")),
823823
pytest.param(games.read_from_file("e02.efg")),
824-
pytest.param(games.read_from_file("poker.efg")),
824+
pytest.param(games.read_from_file("myerson_2_card_poker.efg")),
825825
pytest.param(gbt.Game.new_tree()),
826826
],
827827
)

0 commit comments

Comments
 (0)