@@ -20,6 +20,16 @@ def test_init():
2020 assert player .original_function .restype == c_int
2121
2222
23+ def test_matches ():
24+ for strategy in all_strategies :
25+ for opponent in (Alternator , Cooperator , Defector ):
26+ players = (Player (strategy ), opponent ())
27+ match = Match (players , 50 )
28+ assert all (
29+ action in (C , D ) for interaction in match .play ()
30+ for action in interaction )
31+
32+
2333@given (
2434 their_last_move = integers (min_value = 0 , max_value = 1 ),
2535 move_number = integers (min_value = 1 , max_value = 200 ),
@@ -35,13 +45,3 @@ def test_original_strategy(
3545 their_last_move , move_number , my_score , their_score , 0 ,
3646 my_last_move )
3747 assert action in (0 , 1 ), print (f'{ strategy } returned { action } ' )
38-
39-
40- def test_matches ():
41- for strategy in all_strategies :
42- for opponent in (Alternator , Cooperator , Defector ):
43- players = (Player (strategy ), opponent ())
44- match = Match (players , 50 )
45- assert all (
46- action in (C , D ) for interaction in match .play ()
47- for action in interaction )
0 commit comments