Skip to content

Commit a7c9b32

Browse files
committed
And again...
1 parent daf594f commit a7c9b32

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pandas/tests/test_algos.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,13 @@ def test_complex_sorting(self):
229229
# gh 12666 - check no segfault
230230
x17 = np.array([complex(i) for i in range(17)], dtype=object)
231231

232-
msg = ("no ordering relation.*|unorderable types:.*"
232+
msg = ("unorderable types: {0} [<>] {0}".format(r"complex\(\)")
233233
if _np_version_under1p14 else
234234
"'[<>]' not supported between instances of {0} and {0}".format(
235235
"'complex'")
236236
)
237+
if PY2:
238+
msg = msg + "|no ordering relation is defined for complex numbers"
237239
with pytest.raises(TypeError, match=msg):
238240
algos.factorize(x17[::-1], sort=True)
239241

pandas/tests/test_sorting.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,15 @@ def test_mixed_integer_from_list(self):
408408
def test_unsortable(self):
409409
# GH 13714
410410
arr = np.array([1, 2, datetime.now(), 0, 3], dtype=object)
411-
msg = ("can't compare.*|unorderable types:.*"
411+
msg = ("unorderable types: ({0} [<>] {1}|{1} [<>] {0})".format(
412+
r"int\(\)", r"datetime\.datetime\(\)") # noqa: E126
412413
if _np_version_under1p14 else
413414
("'[<>]' not supported between instances of "
414415
"({0} and {1}|{1} and {0})").format(
415416
"'int'", r"'datetime\.datetime'")
416417
)
417418
if compat.PY2:
419+
msg = msg + "|can't compare datetime.datetime to int"
418420
# RuntimeWarning: tp_compare didn't return -1 or -2 for exception
419421
with warnings.catch_warnings():
420422
with pytest.raises(TypeError, match=msg):

0 commit comments

Comments
 (0)