Skip to content

Commit 147fa83

Browse files
added test_games_match
1 parent c87d438 commit 147fa83

File tree

1 file changed

+51
-24
lines changed

1 file changed

+51
-24
lines changed

tests/test_nash.py

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -847,27 +847,54 @@ def test_logit_solve_lambda():
847847
game=game, lam=[1, 2, 3], first_step=0.2, max_accel=1)) > 0
848848

849849

850-
def test_kuhn():
851-
"""
852-
TEMPORARY
853-
854-
Check that the reduced strategic forms match for the versions with and without
855-
nonterminal nodes
856-
"""
857-
old = games.create_kuhn_poker_efg(nonterm_outcomes=False)
858-
new = games.create_kuhn_poker_efg(nonterm_outcomes=True)
859-
for i in [0, 1]:
860-
assert (old.to_arrays()[i] == new.to_arrays()[i]).all()
861-
862-
863-
def test_stripped():
864-
"""
865-
TEMPORARY
866-
867-
Check that the reduced strategic forms match for the versions with and without
868-
nonterminal nodes
869-
"""
870-
old = games.create_stripped_down_poker_efg()
871-
new = games.create_stripped_down_poker_efg(nonterm_outcomes=True)
872-
for i in [0, 1]:
873-
assert (old.to_arrays()[i] == new.to_arrays()[i]).all()
850+
@pytest.mark.parametrize(
851+
"standard, modified",
852+
[
853+
(
854+
games.create_two_player_perfect_info_win_lose_efg(),
855+
games.create_two_player_perfect_info_win_lose_efg(nonterm_outcomes=True)
856+
),
857+
(
858+
games.create_3_player_with_internal_outcomes_efg(),
859+
games.create_3_player_with_internal_outcomes_efg(nonterm_outcomes=True)
860+
),
861+
(
862+
games.create_chance_in_middle_efg(),
863+
games.create_chance_in_middle_efg(nonterm_outcomes=True)
864+
),
865+
(
866+
games.create_non_zero_sum_lacking_outcome_efg(),
867+
games.create_non_zero_sum_lacking_outcome_efg(missing_term_outcome=True)
868+
),
869+
(
870+
games.create_entry_accomodation_efg(),
871+
games.create_entry_accomodation_efg(nonterm_outcomes=True)
872+
),
873+
(
874+
games.create_three_action_internal_outcomes_efg(),
875+
games.create_three_action_internal_outcomes_efg(nonterm_outcomes=True)
876+
),
877+
(
878+
games.create_kuhn_poker_efg(),
879+
games.create_kuhn_poker_efg(nonterm_outcomes=True)
880+
),
881+
(
882+
games.create_stripped_down_poker_efg(),
883+
games.create_stripped_down_poker_efg(nonterm_outcomes=True)
884+
),
885+
(
886+
games.create_2x2_zero_sum_efg(),
887+
games.create_2x2_zero_sum_efg(missing_term_outcome=True)
888+
),
889+
(
890+
games.create_matching_pennies_efg(),
891+
games.create_matching_pennies_efg(with_neutral_outcome=True)
892+
),
893+
],
894+
)
895+
def test_games_match(standard: gbt.Game, modified: gbt.Game):
896+
arrays_standard = standard.to_arrays()
897+
arrays_modified = modified.to_arrays()
898+
assert (len(arrays_standard) == len(arrays_modified))
899+
for i in range(len(arrays_standard)):
900+
assert (arrays_standard[i] == arrays_modified[i]).all()

0 commit comments

Comments
 (0)