@@ -17,7 +17,7 @@ def test_index_equal_levels_mismatch():
17
17
msg = """Index are different
18
18
19
19
Index levels are different
20
- \\ [left\\ ]: 1, Int64Index \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
20
+ \\ [left\\ ]: 1, NumericIndex \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
21
21
\\ [right\\ ]: 2, MultiIndex\\ (\\ [\\ ('A', 1\\ ),
22
22
\\ ('A', 2\\ ),
23
23
\\ ('B', 3\\ ),
@@ -35,8 +35,8 @@ def test_index_equal_values_mismatch(check_exact):
35
35
msg = """MultiIndex level \\ [1\\ ] are different
36
36
37
37
MultiIndex level \\ [1\\ ] values are different \\ (25\\ .0 %\\ )
38
- \\ [left\\ ]: Int64Index \\ (\\ [2, 2, 3, 4\\ ], dtype='int64'\\ )
39
- \\ [right\\ ]: Int64Index \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
38
+ \\ [left\\ ]: NumericIndex \\ (\\ [2, 2, 3, 4\\ ], dtype='int64'\\ )
39
+ \\ [right\\ ]: NumericIndex \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
40
40
41
41
idx1 = MultiIndex .from_tuples ([("A" , 2 ), ("A" , 2 ), ("B" , 3 ), ("B" , 4 )])
42
42
idx2 = MultiIndex .from_tuples ([("A" , 1 ), ("A" , 2 ), ("B" , 3 ), ("B" , 4 )])
@@ -49,8 +49,8 @@ def test_index_equal_length_mismatch(check_exact):
49
49
msg = """Index are different
50
50
51
51
Index length are different
52
- \\ [left\\ ]: 3, Int64Index \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
53
- \\ [right\\ ]: 4, Int64Index \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
52
+ \\ [left\\ ]: 3, NumericIndex \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
53
+ \\ [right\\ ]: 4, NumericIndex \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
54
54
55
55
idx1 = Index ([1 , 2 , 3 ])
56
56
idx2 = Index ([1 , 2 , 3 , 4 ])
@@ -67,22 +67,29 @@ def test_index_equal_class(exact):
67
67
tm .assert_index_equal (idx1 , idx2 , exact = exact )
68
68
69
69
70
- @pytest .mark .parametrize (
71
- "idx_values, msg_str" ,
72
- [
73
- [[1 , 2 , 3.0 ], "Float64Index\\ (\\ [1\\ .0, 2\\ .0, 3\\ .0\\ ], dtype='float64'\\ )" ],
74
- [range (3 ), "RangeIndex\\ (start=0, stop=3, step=1\\ )" ],
75
- ],
76
- )
77
- def test_index_equal_class_mismatch (check_exact , idx_values , msg_str ):
78
- msg = f"""Index are different
70
+ def test_int_float_index_equal_class_mismatch (check_exact ):
71
+ msg = """Index are different
72
+
73
+ Attribute "inferred_type" are different
74
+ \\ [left\\ ]: integer
75
+ \\ [right\\ ]: floating"""
76
+
77
+ idx1 = Index ([1 , 2 , 3 ])
78
+ idx2 = Index ([1 , 2 , 3 ], dtype = np .float64 )
79
+
80
+ with pytest .raises (AssertionError , match = msg ):
81
+ tm .assert_index_equal (idx1 , idx2 , exact = True , check_exact = check_exact )
82
+
83
+
84
+ def test_range_index_equal_class_mismatch (check_exact ):
85
+ msg = """Index are different
79
86
80
87
Index classes are different
81
- \\ [left\\ ]: Int64Index \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
82
- \\ [right\\ ]: { msg_str } """
88
+ \\ [left\\ ]: NumericIndex \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
89
+ \\ [right\\ ]: """
83
90
84
91
idx1 = Index ([1 , 2 , 3 ])
85
- idx2 = Index ( idx_values )
92
+ idx2 = RangeIndex ( range ( 3 ) )
86
93
87
94
with pytest .raises (AssertionError , match = msg ):
88
95
tm .assert_index_equal (idx1 , idx2 , exact = True , check_exact = check_exact )
@@ -96,8 +103,8 @@ def test_index_equal_values_close(check_exact):
96
103
msg = """Index are different
97
104
98
105
Index values are different \\ (33\\ .33333 %\\ )
99
- \\ [left\\ ]: Float64Index \\ (\\ [1.0, 2.0, 3.0], dtype='float64'\\ )
100
- \\ [right\\ ]: Float64Index \\ (\\ [1.0, 2.0, 3.0000000001\\ ], dtype='float64'\\ )"""
106
+ \\ [left\\ ]: NumericIndex \\ (\\ [1.0, 2.0, 3.0], dtype='float64'\\ )
107
+ \\ [right\\ ]: NumericIndex \\ (\\ [1.0, 2.0, 3.0000000001\\ ], dtype='float64'\\ )"""
101
108
102
109
with pytest .raises (AssertionError , match = msg ):
103
110
tm .assert_index_equal (idx1 , idx2 , check_exact = check_exact )
@@ -114,8 +121,8 @@ def test_index_equal_values_less_close(check_exact, rtol):
114
121
msg = """Index are different
115
122
116
123
Index values are different \\ (33\\ .33333 %\\ )
117
- \\ [left\\ ]: Float64Index \\ (\\ [1.0, 2.0, 3.0], dtype='float64'\\ )
118
- \\ [right\\ ]: Float64Index \\ (\\ [1.0, 2.0, 3.0001\\ ], dtype='float64'\\ )"""
124
+ \\ [left\\ ]: NumericIndex \\ (\\ [1.0, 2.0, 3.0], dtype='float64'\\ )
125
+ \\ [right\\ ]: NumericIndex \\ (\\ [1.0, 2.0, 3.0001\\ ], dtype='float64'\\ )"""
119
126
120
127
with pytest .raises (AssertionError , match = msg ):
121
128
tm .assert_index_equal (idx1 , idx2 , ** kwargs )
@@ -131,8 +138,8 @@ def test_index_equal_values_too_far(check_exact, rtol):
131
138
msg = """Index are different
132
139
133
140
Index values are different \\ (33\\ .33333 %\\ )
134
- \\ [left\\ ]: Int64Index \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
135
- \\ [right\\ ]: Int64Index \\ (\\ [1, 2, 4\\ ], dtype='int64'\\ )"""
141
+ \\ [left\\ ]: NumericIndex \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
142
+ \\ [right\\ ]: NumericIndex \\ (\\ [1, 2, 4\\ ], dtype='int64'\\ )"""
136
143
137
144
with pytest .raises (AssertionError , match = msg ):
138
145
tm .assert_index_equal (idx1 , idx2 , ** kwargs )
@@ -146,8 +153,8 @@ def test_index_equal_value_oder_mismatch(check_exact, rtol, check_order):
146
153
msg = """Index are different
147
154
148
155
Index values are different \\ (66\\ .66667 %\\ )
149
- \\ [left\\ ]: Int64Index \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
150
- \\ [right\\ ]: Int64Index \\ (\\ [3, 2, 1\\ ], dtype='int64'\\ )"""
156
+ \\ [left\\ ]: NumericIndex \\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
157
+ \\ [right\\ ]: NumericIndex \\ (\\ [3, 2, 1\\ ], dtype='int64'\\ )"""
151
158
152
159
if check_order :
153
160
with pytest .raises (AssertionError , match = msg ):
@@ -168,8 +175,8 @@ def test_index_equal_level_values_mismatch(check_exact, rtol):
168
175
msg = """MultiIndex level \\ [1\\ ] are different
169
176
170
177
MultiIndex level \\ [1\\ ] values are different \\ (25\\ .0 %\\ )
171
- \\ [left\\ ]: Int64Index \\ (\\ [2, 2, 3, 4\\ ], dtype='int64'\\ )
172
- \\ [right\\ ]: Int64Index \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
178
+ \\ [left\\ ]: NumericIndex \\ (\\ [2, 2, 3, 4\\ ], dtype='int64'\\ )
179
+ \\ [right\\ ]: NumericIndex \\ (\\ [1, 2, 3, 4\\ ], dtype='int64'\\ )"""
173
180
174
181
with pytest .raises (AssertionError , match = msg ):
175
182
tm .assert_index_equal (idx1 , idx2 , ** kwargs )
@@ -225,7 +232,7 @@ def test_index_equal_range_categories(check_categorical, exact):
225
232
226
233
Index classes are different
227
234
\\ [left\\ ]: RangeIndex\\ (start=0, stop=10, step=1\\ )
228
- \\ [right\\ ]: Int64Index \\ (\\ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9\\ ], dtype='int64'\\ )"""
235
+ \\ [right\\ ]: NumericIndex \\ (\\ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9\\ ], dtype='int64'\\ )"""
229
236
230
237
rcat = CategoricalIndex (RangeIndex (10 ))
231
238
icat = CategoricalIndex (list (range (10 )))
0 commit comments