44 datetime ,
55 timedelta ,
66)
7- import itertools
87
98import numpy as np
109import pytest
2322###############################################################
2423
2524
26- @pytest .fixture (autouse = True , scope = "class" )
27- def check_comprehensiveness (request ):
28- # Iterate over combination of dtype, method and klass
29- # and ensure that each are contained within a collected test
30- cls = request .cls
31- combos = itertools .product (cls .klasses , cls .dtypes , [cls .method ])
32-
33- def has_test (combo ):
34- klass , dtype , method = combo
35- cls_funcs = request .node .session .items
36- return any (
37- klass in x .name and dtype in x .name and method in x .name for x in cls_funcs
38- )
39-
40- opts = request .config .option
41- if opts .lf or opts .keyword :
42- # If we are running with "last-failed" or -k foo, we expect to only
43- # run a subset of tests.
44- yield
45-
46- else :
47- for combo in combos :
48- if not has_test (combo ):
49- raise AssertionError (
50- f"test method is not defined: { cls .__name__ } , { combo } "
51- )
52-
53- yield
54-
55-
5625class CoercionBase :
5726 klasses = ["index" , "series" ]
5827 dtypes = [
@@ -541,10 +510,6 @@ class TestFillnaSeriesCoercion(CoercionBase):
541510
542511 method = "fillna"
543512
544- @pytest .mark .xfail (reason = "Test not implemented" )
545- def test_has_comprehensive_tests (self ):
546- raise NotImplementedError
547-
548513 def _assert_fillna_conversion (self , original , value , expected , expected_dtype ):
549514 """test coercion triggered by fillna"""
550515 target = original .copy ()
@@ -823,7 +788,7 @@ def replacer(self, how, from_key, to_key):
823788 raise ValueError
824789 return replacer
825790
826- def test_replace_series (self , how , to_key , from_key , replacer ):
791+ def test_replace_series (self , to_key , from_key , replacer ):
827792 index = pd .Index ([3 , 4 ], name = "xxx" )
828793 obj = pd .Series (self .rep [from_key ], index = index , name = "yyy" )
829794 obj = obj .astype (from_key )
@@ -860,7 +825,7 @@ def test_replace_series(self, how, to_key, from_key, replacer):
860825 "from_key" , ["datetime64[ns, UTC]" , "datetime64[ns, US/Eastern]" ], indirect = True
861826 )
862827 def test_replace_series_datetime_tz (
863- self , how , to_key , from_key , replacer , using_infer_string
828+ self , to_key , from_key , replacer , using_infer_string
864829 ):
865830 index = pd .Index ([3 , 4 ], name = "xyz" )
866831 obj = pd .Series (self .rep [from_key ], index = index , name = "yyy" ).dt .as_unit ("ns" )
@@ -885,7 +850,7 @@ def test_replace_series_datetime_tz(
885850 ["datetime64[ns]" , "datetime64[ns, UTC]" , "datetime64[ns, US/Eastern]" ],
886851 indirect = True ,
887852 )
888- def test_replace_series_datetime_datetime (self , how , to_key , from_key , replacer ):
853+ def test_replace_series_datetime_datetime (self , to_key , from_key , replacer ):
889854 index = pd .Index ([3 , 4 ], name = "xyz" )
890855 obj = pd .Series (self .rep [from_key ], index = index , name = "yyy" ).dt .as_unit ("ns" )
891856 assert obj .dtype == from_key
0 commit comments