Skip to content

Revert changes to test regexes #25874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pandas/tests/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to just replace if _np_version_under1p14 else with "|"

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)

Expand Down
14 changes: 5 additions & 9 deletions pandas/tests/test_sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

(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)

Expand Down