diff --git a/pandas/tests/test_algos.py b/pandas/tests/test_algos.py index e6c00e11d42a9..b8226bc2f8269 100644 --- a/pandas/tests/test_algos.py +++ b/pandas/tests/test_algos.py @@ -20,7 +20,7 @@ import pandas as pd from pandas import ( Categorical, CategoricalIndex, DatetimeIndex, Index, IntervalIndex, Series, - Timestamp, _np_version_under1p14, compat) + Timestamp, compat) import pandas.core.algorithms as algos from pandas.core.arrays import DatetimeArray import pandas.core.common as com @@ -228,11 +228,9 @@ def test_complex_sorting(self): # gh 12666 - check no segfault x17 = np.array([complex(i) for i in range(17)], dtype=object) - msg = (r"unorderable types: {0} [<>] {0}".format(r"complex\(\)") - if _np_version_under1p14 else - r"'[<>]' not supported between instances of {0} and {0}".format( - "'complex'") - ) + msg = (r"'(<|>)' not supported between instances of 'complex' and" + r" 'complex'|" + r"unorderable types: complex\(\) > complex\(\)") with pytest.raises(TypeError, match=msg): algos.factorize(x17[::-1], sort=True) diff --git a/pandas/tests/test_sorting.py b/pandas/tests/test_sorting.py index 14b5f1cb509fa..c753b5531fde7 100644 --- a/pandas/tests/test_sorting.py +++ b/pandas/tests/test_sorting.py @@ -7,8 +7,7 @@ import pytest from pandas import ( - DataFrame, MultiIndex, Series, _np_version_under1p14, compat, concat, - merge, to_datetime) + DataFrame, MultiIndex, Series, compat, concat, merge, to_datetime) from pandas.core import common as com from pandas.core.sorting import ( decons_group_index, get_group_index, is_int64_overflow_possible, @@ -414,13 +413,10 @@ def test_mixed_integer_from_list(self): def test_unsortable(self): # GH 13714 arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object) - msg = (r"unorderable types: ({0} [<>] {1}|{1} [<>] {0})".format( - r"int\(\)", r"datetime\.datetime\(\)") # noqa: E126 - if _np_version_under1p14 else - (r"'[<>]' not supported between instances of " - r"({0} and {1}|{1} and {0})").format( - "'int'", r"'datetime\.datetime'") - ) + msg = (r"'(<|>)' not supported between instances of ('" + r"datetime\.datetime' and 'int'|'int' and 'datetime\.datetime" + r"')|" + r"unorderable types: int\(\) > datetime\.datetime\(\)") with pytest.raises(TypeError, match=msg): safe_sort(arr)