@@ -68,8 +68,6 @@ def value_function(self, coalition):
68
68
# test wrong datatype in coalition call
69
69
with pytest .raises (TypeError ):
70
70
assert test_game ({0 , 1 , 2 }) == 0.0
71
-
72
- # test wrong datatype in coalition call
73
71
with pytest .raises (TypeError ):
74
72
assert test_game ([(None )]) == 0.0
75
73
@@ -78,6 +76,7 @@ def value_function(self, coalition):
78
76
assert test_game (test_coalition ) == 0.0
79
77
assert test_game (()) == 0.0
80
78
assert test_game ([()]) == 0.0
79
+ assert test_game ("empty" ) == 0.0
81
80
82
81
# test with grand coalition all call variants
83
82
test_coalition = test_game .grand_coalition
@@ -86,6 +85,7 @@ def value_function(self, coalition):
86
85
assert test_game ([tuple (range (0 , test_game .n_players ))]) == 1.0
87
86
assert test_game (tuple (test_game .player_name_lookup .values ())) == 1.0
88
87
assert test_game ([tuple (test_game .player_name_lookup .values ())]) == 1.0
88
+ assert test_game ("grand" ) == 1.0
89
89
90
90
# test with single player coalition all call variants
91
91
test_coalition = np .array ([True ] + [False for _ in range (test_game .n_players - 1 )])
@@ -94,6 +94,18 @@ def value_function(self, coalition):
94
94
assert test_game ([tuple ([0 ])]) - 1 / 6 < 10e-7
95
95
assert test_game (tuple (("Alice" ,))) - 1 / 6 < 10e-7
96
96
assert test_game ([tuple (("Alice" ,))]) - 1 / 6 < 10e-7
97
+ assert test_game ("Alice" ) - 1 / 6 < 10e-7
98
+
99
+ # test string calls with missing player names
100
+ test_game2 = TestGame (n = n_players )
101
+ assert test_game2 ("grand" ) == 1.0
102
+ assert test_game2 ("empty" ) == 0.0
103
+ with pytest .raises (TypeError ):
104
+ assert test_game2 ("Alice" ) == 0.0
105
+ with pytest .raises (TypeError ):
106
+ assert test_game2 (("Bob" ,)) == 0.0
107
+ with pytest .raises (TypeError ):
108
+ assert test_game2 ([("Charlie" ,)]) == 0.0
97
109
98
110
99
111
def test_precompute ():
0 commit comments