@@ -115,6 +115,28 @@ def test_index_equal_values_too_far(check_exact, rtol):
115
115
tm .assert_index_equal (idx1 , idx2 , ** kwargs )
116
116
117
117
118
+ @pytest .mark .parametrize ("check_order" , [True , False ])
119
+ def test_index_equal_value_oder_mismatch (check_exact , rtol , check_order ):
120
+ idx1 = Index ([1 , 2 , 3 ])
121
+ idx2 = Index ([3 , 2 , 1 ])
122
+
123
+ msg = """Index are different
124
+
125
+ Index values are different \\ (66\\ .66667 %\\ )
126
+ \\ [left\\ ]: Int64Index\\ (\\ [1, 2, 3\\ ], dtype='int64'\\ )
127
+ \\ [right\\ ]: Int64Index\\ (\\ [3, 2, 1\\ ], dtype='int64'\\ )"""
128
+
129
+ if check_order :
130
+ with pytest .raises (AssertionError , match = msg ):
131
+ tm .assert_index_equal (
132
+ idx1 , idx2 , check_exact = check_exact , rtol = rtol , check_order = True
133
+ )
134
+ else :
135
+ tm .assert_index_equal (
136
+ idx1 , idx2 , check_exact = check_exact , rtol = rtol , check_order = False
137
+ )
138
+
139
+
118
140
def test_index_equal_level_values_mismatch (check_exact , rtol ):
119
141
idx1 = MultiIndex .from_tuples ([("A" , 2 ), ("A" , 2 ), ("B" , 3 ), ("B" , 4 )])
120
142
idx2 = MultiIndex .from_tuples ([("A" , 1 ), ("A" , 2 ), ("B" , 3 ), ("B" , 4 )])
0 commit comments