Skip to content

Commit 2d38d6a

Browse files
committed
TST: unsortable only on PY3, pandas-dev#11138
1 parent 2dd4335 commit 2d38d6a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/tests/test_categorical.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,14 @@ def test_constructor_unsortable(self):
8686
factor = Categorical.from_array(arr, ordered=False)
8787
self.assertFalse(factor.ordered)
8888

89-
# this however will raise as cannot be sorted
90-
self.assertRaises(TypeError, lambda : Categorical.from_array(arr, ordered=True))
89+
if compat.PY3:
90+
self.assertRaises(TypeError, lambda : Categorical.from_array(arr, ordered=True))
91+
else:
92+
# this however will raise as cannot be sorted (on PY3 or older numpies)
93+
if LooseVersion(np.__version__) < "1.10":
94+
self.assertRaises(TypeError, lambda : Categorical.from_array(arr, ordered=True))
95+
else:
96+
Categorical.from_array(arr, ordered=True)
9197

9298
def test_is_equal_dtype(self):
9399

0 commit comments

Comments
 (0)