Skip to content

Commit df6b2cd

Browse files
WillAydjreback
authored andcommitted
Revert changed to test regexes (#25874)
1 parent 324bb84 commit df6b2cd

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

pandas/tests/test_algos.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import pandas as pd
2121
from pandas import (
2222
Categorical, CategoricalIndex, DatetimeIndex, Index, IntervalIndex, Series,
23-
Timestamp, _np_version_under1p14, compat)
23+
Timestamp, compat)
2424
import pandas.core.algorithms as algos
2525
from pandas.core.arrays import DatetimeArray
2626
import pandas.core.common as com
@@ -228,11 +228,9 @@ def test_complex_sorting(self):
228228
# gh 12666 - check no segfault
229229
x17 = np.array([complex(i) for i in range(17)], dtype=object)
230230

231-
msg = (r"unorderable types: {0} [<>] {0}".format(r"complex\(\)")
232-
if _np_version_under1p14 else
233-
r"'[<>]' not supported between instances of {0} and {0}".format(
234-
"'complex'")
235-
)
231+
msg = (r"'(<|>)' not supported between instances of 'complex' and"
232+
r" 'complex'|"
233+
r"unorderable types: complex\(\) > complex\(\)")
236234
with pytest.raises(TypeError, match=msg):
237235
algos.factorize(x17[::-1], sort=True)
238236

pandas/tests/test_sorting.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
import pytest
88

99
from pandas import (
10-
DataFrame, MultiIndex, Series, _np_version_under1p14, compat, concat,
11-
merge, to_datetime)
10+
DataFrame, MultiIndex, Series, compat, concat, merge, to_datetime)
1211
from pandas.core import common as com
1312
from pandas.core.sorting import (
1413
decons_group_index, get_group_index, is_int64_overflow_possible,
@@ -414,13 +413,10 @@ def test_mixed_integer_from_list(self):
414413
def test_unsortable(self):
415414
# GH 13714
416415
arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object)
417-
msg = (r"unorderable types: ({0} [<>] {1}|{1} [<>] {0})".format(
418-
r"int\(\)", r"datetime\.datetime\(\)") # noqa: E126
419-
if _np_version_under1p14 else
420-
(r"'[<>]' not supported between instances of "
421-
r"({0} and {1}|{1} and {0})").format(
422-
"'int'", r"'datetime\.datetime'")
423-
)
416+
msg = (r"'(<|>)' not supported between instances of ('"
417+
r"datetime\.datetime' and 'int'|'int' and 'datetime\.datetime"
418+
r"')|"
419+
r"unorderable types: int\(\) > datetime\.datetime\(\)")
424420
with pytest.raises(TypeError, match=msg):
425421
safe_sort(arr)
426422

0 commit comments

Comments
 (0)