@@ -46,6 +46,9 @@ def setUp(self) -> None:
4646 # Ignore warnings about classifiers running on instances
4747 warnings .simplefilter ("ignore" , category = UserWarning )
4848
49+ def tearDown (self ) -> None :
50+ warnings .simplefilter ("default" , category = UserWarning )
51+
4952 def test_classifier_build (self ):
5053 dirname = os .path .dirname (__file__ )
5154 test_path = os .path .join (dirname , "../../../test_outputs/classifier_test.yaml" )
@@ -75,8 +78,13 @@ def test_singletonity_of_classifiers_class(self):
7578
7679 def test_get_name_from_classifier (self ):
7780 # Should be able to take a string or a Classifier instance.
78- self .assertEqual (Classifiers ["memory_depth" ](axl .TitForTat ), 1 )
79- self .assertEqual (Classifiers [memory_depth ](axl .TitForTat ), 1 )
81+ self .assertEqual (Classifiers ["memory_depth" ](axl .TitForTat ()), 1 )
82+ self .assertEqual (Classifiers [memory_depth ](axl .TitForTat ()), 1 )
83+
84+ def test_classifier_works_on_non_instances (self ):
85+ with warnings .catch_warnings (record = True ) as w :
86+ self .assertEqual (Classifiers ["memory_depth" ](axl .TitForTat ), 1 )
87+ self .assertEquals (len (w ), 1 )
8088
8189 def test_key_error_on_uknown_classifier (self ):
8290 with self .assertRaises (KeyError ):
@@ -219,13 +227,13 @@ def test_is_basic(self):
219227 ]
220228
221229 for strategy in known_cheaters :
222- self .assertFalse (axl .Classifiers .is_basic (strategy ), msg = strategy )
230+ self .assertFalse (axl .Classifiers .is_basic (strategy () ), msg = strategy )
223231
224232 for strategy in known_basic :
225- self .assertTrue (axl .Classifiers .is_basic (strategy ), msg = strategy )
233+ self .assertTrue (axl .Classifiers .is_basic (strategy () ), msg = strategy )
226234
227235 for strategy in known_ordinary :
228- self .assertFalse (axl .Classifiers .is_basic (strategy ), msg = strategy )
236+ self .assertFalse (axl .Classifiers .is_basic (strategy () ), msg = strategy )
229237
230238
231239def str_reps (xs ):
0 commit comments