@@ -82,6 +82,7 @@ def test_get_name_from_classifier(self):
8282 self .assertEqual (Classifiers [memory_depth ](axl .TitForTat ()), 1 )
8383
8484 def test_classifier_works_on_non_instances (self ):
85+ warnings .simplefilter ("default" , category = UserWarning )
8586 with warnings .catch_warnings (record = True ) as w :
8687 self .assertEqual (Classifiers ["memory_depth" ](axl .TitForTat ), 1 )
8788 self .assertEquals (len (w ), 1 )
@@ -185,13 +186,13 @@ def test_obey_axelrod(self):
185186 ]
186187
187188 for strategy in known_cheaters :
188- self .assertFalse (axl .Classifiers .obey_axelrod (strategy ), msg = strategy )
189+ self .assertFalse (axl .Classifiers .obey_axelrod (strategy () ), msg = strategy )
189190
190191 for strategy in known_basic :
191- self .assertTrue (axl .Classifiers .obey_axelrod (strategy ), msg = strategy )
192+ self .assertTrue (axl .Classifiers .obey_axelrod (strategy () ), msg = strategy )
192193
193194 for strategy in known_ordinary :
194- self .assertTrue (axl .Classifiers .obey_axelrod (strategy ), msg = strategy )
195+ self .assertTrue (axl .Classifiers .obey_axelrod (strategy () ), msg = strategy )
195196
196197 def test_is_basic (self ):
197198 """A test that verifies if the is_basic function works correctly"""
@@ -242,6 +243,14 @@ def str_reps(xs):
242243
243244
244245class TestStrategies (unittest .TestCase ):
246+ def setUp (self ) -> None :
247+ # Ignore warnings about classifiers running on instances. We want to
248+ # allow this for some of the map functions.
249+ warnings .simplefilter ("ignore" , category = UserWarning )
250+
251+ def tearDown (self ) -> None :
252+ warnings .simplefilter ("default" , category = UserWarning )
253+
245254 def test_strategy_list (self ):
246255 for strategy_list in [
247256 "all_strategies" ,
0 commit comments