@@ -93,10 +93,12 @@ def test_state_distribution(self):
9393 match = axl .Match ((player1 , player2 ), turns = 5 )
9494 _ = match .play ()
9595 self .assertEqual (
96- player1 .state_distribution , {(C , C ): 1 , (C , D ): 2 , (D , C ): 1 , (D , D ): 1 }
96+ player1 .state_distribution ,
97+ {(C , C ): 1 , (C , D ): 2 , (D , C ): 1 , (D , D ): 1 },
9798 )
9899 self .assertEqual (
99- player2 .state_distribution , {(C , C ): 1 , (C , D ): 1 , (D , C ): 2 , (D , D ): 1 }
100+ player2 .state_distribution ,
101+ {(C , C ): 1 , (C , D ): 1 , (D , C ): 2 , (D , D ): 1 },
100102 )
101103
102104 def test_noisy_play (self ):
@@ -129,7 +131,9 @@ def test_history_assignment(self):
129131 player .history = []
130132
131133 def test_strategy (self ):
132- self .assertRaises (NotImplementedError , self .player ().strategy , self .player ())
134+ self .assertRaises (
135+ NotImplementedError , self .player ().strategy , self .player ()
136+ )
133137
134138 def test_clone (self ):
135139 """Tests player cloning."""
@@ -345,7 +349,9 @@ def test_init_kwargs(self):
345349 # Test that passing an unknown keyword argument or a spare one raises
346350 # an error.
347351 self .assertRaises (TypeError , ParameterisedTestPlayer , arg_test3 = "test" )
348- self .assertRaises (TypeError , ParameterisedTestPlayer , "other" , "other" , "other" )
352+ self .assertRaises (
353+ TypeError , ParameterisedTestPlayer , "other" , "other" , "other"
354+ )
349355
350356
351357class TestOpponent (axl .Player ):
@@ -496,7 +502,9 @@ def test_clone(self, seed):
496502 self .assertEqual (player1 .history , player2 .history )
497503
498504 @given (
499- strategies = strategy_lists (max_size = 5 , strategies = short_run_time_short_mem ),
505+ strategies = strategy_lists (
506+ max_size = 5 , strategies = short_run_time_short_mem
507+ ),
500508 seed = integers (min_value = 1 , max_value = 200 ),
501509 turns = integers (min_value = 1 , max_value = 200 ),
502510 )
@@ -544,10 +552,8 @@ def versus_test(
544552 ):
545553 """
546554 Tests a sequence of outcomes for two given players.
547-
548555 Parameters:
549556 -----------
550-
551557 opponent: Player or list
552558 An instance of a player OR a sequence of actions. If a sequence of
553559 actions is passed, a Mock Player is created that cycles over that
@@ -605,20 +611,30 @@ def classifier_test(self, expected_class_classifier=None):
605611 # specified
606612 if expected_class_classifier is None :
607613 expected_class_classifier = player .classifier
608- self .assertEqual (expected_class_classifier , self .player .classifier )
614+ actual_class_classifier = {
615+ c : axl .Classifiers [c ](player )
616+ for c in expected_class_classifier .keys ()
617+ }
618+ self .assertEqual (expected_class_classifier , actual_class_classifier )
609619
610620 self .assertTrue (
611- "memory_depth" in player .classifier , msg = "memory_depth not in classifier"
621+ "memory_depth" in player .classifier ,
622+ msg = "memory_depth not in classifier" ,
612623 )
613624 self .assertTrue (
614- "stochastic" in player .classifier , msg = "stochastic not in classifier"
625+ "stochastic" in player .classifier ,
626+ msg = "stochastic not in classifier" ,
615627 )
616628 for key in TestOpponent .classifier :
617629 self .assertEqual (
618630 axl .Classifiers [key ](player ),
619631 self .expected_classifier [key ],
620632 msg = "%s - Behaviour: %s != Expected Behaviour: %s"
621- % (key , axl .Classifiers [key ](player ), self .expected_classifier [key ]),
633+ % (
634+ key ,
635+ axl .Classifiers [key ](player ),
636+ self .expected_classifier [key ],
637+ ),
622638 )
623639
624640
0 commit comments