Skip to content

Commit e344b20

Browse files
committed
TST: fix unordable error message
xref pandas-dev#14679
1 parent d5e0bd5 commit e344b20

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

pandas/compat/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
PY2 = sys.version_info[0] == 2
4242
PY3 = (sys.version_info[0] >= 3)
4343
PY35 = (sys.version_info >= (3, 5))
44+
PY36 = (sys.version_info >= (3, 6))
4445

4546
try:
4647
import __builtin__ as builtins

pandas/tests/indexes/test_base.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .common import Base
88

99
from pandas.compat import (is_platform_windows, range, lrange, lzip, u,
10-
zip, PY3)
10+
zip, PY3, PY36)
1111
import operator
1212
import os
1313

@@ -1774,7 +1774,12 @@ def create_index(self):
17741774
def test_order(self):
17751775
idx = self.create_index()
17761776
# 9816 deprecated
1777-
if PY3:
1777+
if PY36:
1778+
with tm.assertRaisesRegexp(TypeError, "'>' not supported "
1779+
"between instances of 'str' and 'int'"):
1780+
with tm.assert_produces_warning(FutureWarning):
1781+
idx.order()
1782+
elif PY3:
17781783
with tm.assertRaisesRegexp(TypeError, "unorderable types"):
17791784
with tm.assert_produces_warning(FutureWarning):
17801785
idx.order()
@@ -1784,7 +1789,11 @@ def test_order(self):
17841789

17851790
def test_argsort(self):
17861791
idx = self.create_index()
1787-
if PY3:
1792+
if PY36:
1793+
with tm.assertRaisesRegexp(TypeError, "'>' not supported "
1794+
"between instances of 'str' and 'int'"):
1795+
result = idx.argsort()
1796+
elif PY3:
17881797
with tm.assertRaisesRegexp(TypeError, "unorderable types"):
17891798
result = idx.argsort()
17901799
else:
@@ -1794,7 +1803,11 @@ def test_argsort(self):
17941803

17951804
def test_numpy_argsort(self):
17961805
idx = self.create_index()
1797-
if PY3:
1806+
if PY36:
1807+
with tm.assertRaisesRegexp(TypeError, "'>' not supported "
1808+
"between instances of 'str' and 'int'"):
1809+
result = np.argsort(idx)
1810+
elif PY3:
17981811
with tm.assertRaisesRegexp(TypeError, "unorderable types"):
17991812
result = np.argsort(idx)
18001813
else:

0 commit comments

Comments
 (0)