@@ -50,7 +50,7 @@ def construct(box, shape, value=None, dtype=None, **kwargs):
50
50
return box (arr , dtype = dtype , ** kwargs )
51
51
52
52
53
- class Generic :
53
+ class TestGeneric :
54
54
@pytest .mark .parametrize (
55
55
"func" ,
56
56
[
@@ -66,7 +66,7 @@ def test_rename(self, frame_or_series, func):
66
66
67
67
for axis in frame_or_series ._AXIS_ORDERS :
68
68
kwargs = {axis : idx }
69
- obj = construct (4 , ** kwargs )
69
+ obj = construct (frame_or_series , 4 , ** kwargs )
70
70
71
71
# rename a single axis
72
72
result = obj .rename (** {axis : func })
@@ -83,21 +83,22 @@ def test_get_numeric_data(self, frame_or_series):
83
83
}
84
84
85
85
# get the numeric data
86
- o = construct (n , ** kwargs )
86
+ o = construct (frame_or_series , n , ** kwargs )
87
87
result = o ._get_numeric_data ()
88
88
tm .assert_equal (result , o )
89
89
90
90
# non-inclusion
91
91
result = o ._get_bool_data ()
92
- expected = construct (n , value = "empty" , ** kwargs )
92
+ expected = construct (frame_or_series , n , value = "empty" , ** kwargs )
93
93
if isinstance (o , DataFrame ):
94
94
# preserve columns dtype
95
95
expected .columns = o .columns [:0 ]
96
- tm .assert_equal (result , expected )
96
+ # https://github.com/pandas-dev/pandas/issues/50862
97
+ tm .assert_equal (result .reset_index (drop = True ), expected )
97
98
98
99
# get the bool data
99
100
arr = np .array ([True , True , False , True ])
100
- o = construct (n , value = arr , ** kwargs )
101
+ o = construct (frame_or_series , n , value = arr , ** kwargs )
101
102
result = o ._get_numeric_data ()
102
103
tm .assert_equal (result , o )
103
104
@@ -160,7 +161,7 @@ def f(dtype):
160
161
161
162
msg = (
162
163
"compound dtypes are not implemented "
163
- f"in the { frame_or_series .__name__ } frame_or_series "
164
+ f"in the { frame_or_series .__name__ } constructor "
164
165
)
165
166
166
167
with pytest .raises (NotImplementedError , match = msg ):
@@ -257,7 +258,7 @@ def test_api_compat(self, func, frame_or_series):
257
258
# GH 12021
258
259
# compat for __name__, __qualname__
259
260
260
- obj = (frame_or_series , 5 )
261
+ obj = construct (frame_or_series , 5 )
261
262
f = getattr (obj , func )
262
263
assert f .__name__ == func
263
264
assert f .__qualname__ .endswith (func )
0 commit comments