Skip to content

Commit 8fb3d87

Browse files
committed
Add two more tests for Game.get_plays method
1 parent 724ccb7 commit 8fb3d87

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_node.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,3 +787,35 @@ def test_get_plays_node():
787787
} # paths=[0, 1], [0, 1, 1], [1, 1, 1]
788788

789789
assert set(game.get_plays(test_node)) == expected_set_of_plays
790+
791+
792+
def test_get_plays_infoset():
793+
"""Verify `get_plays` returns plays reachable from a given infoset.
794+
"""
795+
game = games.read_from_file("e01.efg")
796+
list_nodes = list(game.nodes)
797+
list_infosets = list(game.infosets)
798+
799+
test_infoset = list_infosets[2] # members' paths=[1, 0], [1]
800+
801+
expected_set_of_plays = {
802+
list_nodes[4], list_nodes[5], list_nodes[7], list_nodes[8]
803+
} # paths=[0, 1, 0], [1, 1, 0], [0, 1], [1, 1]
804+
805+
assert set(game.get_plays(test_infoset)) == expected_set_of_plays
806+
807+
808+
def test_get_plays_action():
809+
"""Verify `get_plays` returns plays reachable from a given action.
810+
"""
811+
game = games.read_from_file("e01.efg")
812+
list_nodes = list(game.nodes)
813+
list_infosets = list(game.infosets)
814+
815+
test_action = list_infosets[2].actions[0] # members' paths=[0, 1, 0], [0, 1]
816+
817+
expected_set_of_plays = {
818+
list_nodes[4], list_nodes[7]
819+
} # paths=[0, 1, 0], [0, 1]
820+
821+
assert set(game.get_plays(test_action)) == expected_set_of_plays

0 commit comments

Comments
 (0)