@@ -15,56 +15,56 @@ class TestAll(unittest.TestCase):
1515 def test_init (self ):
1616 for strategy in all_strategies :
1717 player = Player (strategy )
18- self . assertTrue ( player .classifier ["stochastic" ])
19- self . assertEqual ( player .original_name , strategy )
20- self . assertEqual ( player .original_function .argtypes , (
18+ assert player .classifier ["stochastic" ]
19+ assert player .original_name == strategy
20+ assert player .original_function .argtypes == (
2121 POINTER (c_int ), POINTER (c_int ), POINTER (c_int ), POINTER (c_int ),
22- POINTER (c_float )))
23- self . assertEqual ( player .original_function .restype , c_int )
22+ POINTER (c_float ))
23+ assert player .original_function .restype == c_int
2424
2525 def test_matches (self ):
2626 for strategy in all_strategies :
2727 for opponent in (Alternator , Cooperator , Defector ):
2828 players = (Player (strategy ), opponent ())
2929 match = Match (players , turns = 200 )
30- self . assertTrue ( all (
30+ assert all (
3131 action in (C , D ) for interaction in match .play ()
32- for action in interaction ))
32+ for action in interaction )
3333
3434 def test_noisy_matches (self ):
3535 for strategy in all_strategies :
3636 for opponent in (Alternator , Cooperator , Defector ):
3737 players = (Player (strategy ), opponent ())
3838 match = Match (players , turns = 200 , noise = 0.5 )
39- self . assertTrue ( all (
39+ assert all (
4040 action in (C , D ) for interaction in match .play ()
41- for action in interaction ))
41+ for action in interaction )
4242
4343 def test_probend_matches (self ):
4444 for strategy in all_strategies :
4545 for opponent in (Alternator , Cooperator , Defector ):
4646 players = (Player (strategy ), opponent ())
4747 match = Match (players , prob_end = 0.5 )
48- self . assertTrue ( all (
48+ assert all (
4949 action in (C , D ) for interaction in match .play ()
50- for action in interaction ))
50+ for action in interaction )
5151
5252 def test_matches_with_different_game (self ):
5353 for strategy in all_strategies :
5454 for opponent in (Alternator , Cooperator , Defector ):
5555 game = Game (r = 4 ,s = 0 ,p = 2 ,t = 6 )
5656 players = (Player (strategy , game = game ), opponent ())
5757 match = Match (players , turns = 200 , game = game )
58- self . assertTrue ( all (
58+ assert all (
5959 action in (C , D ) for interaction in match .play ()
60- for action in interaction ))
60+ for action in interaction )
6161
6262 def test_random (self ):
6363 random .seed (10 )
6464 players = (Player ("KRANDOMC" ), Player ("KRANDOMC" ))
6565 match = Match (players , 5 )
6666 expected = [(C , D ), (C , D ), (C , C ), (C , D ), (C , D )]
67- self . assertEqual ( match .play (), expected )
67+ assert match .play () == expected
6868
6969 def test_original_strategy (self ):
7070 """
@@ -91,7 +91,7 @@ def test_original_strategy(self):
9191 random_value = 0 ,
9292 my_last_move = my_action )
9393
94- self . assertTrue ( my_action in [0 , 1 ])
94+ assert my_action in [0 , 1 ]
9595
9696 scores = actions_to_scores [my_action , action ]
9797 their_previous_action = action
0 commit comments