Skip to content

Commit d8f6564

Browse files
committed
Limit use of 'long' to Python 2.
1 parent 4a2a516 commit d8f6564

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libs/numpy/test/dtype.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import dtype_mod
99
import unittest
1010
import numpy
11+
import sys
1112

1213
class DtypeTestCase(unittest.TestCase):
1314

@@ -27,8 +28,9 @@ def testIntegers(self):
2728
self.assertEquivalent(fu(True), numpy.dtype(u))
2829
self.assertEquivalent(fs(int(1)), numpy.dtype(s))
2930
self.assertEquivalent(fu(int(1)), numpy.dtype(u))
30-
self.assertEquivalent(fs(long(1)), numpy.dtype(s))
31-
self.assertEquivalent(fu(long(1)), numpy.dtype(u))
31+
if sys.version_info[0] == 2:
32+
self.assertEquivalent(fs(long(1)), numpy.dtype(s))
33+
self.assertEquivalent(fu(long(1)), numpy.dtype(u))
3234
for name in ("bool_", "byte", "ubyte", "short", "ushort", "intc", "uintc"):
3335
t = getattr(numpy, name)
3436
ft = getattr(dtype_mod, "accept_%s" % name)
@@ -37,7 +39,8 @@ def testIntegers(self):
3739
self.assertEquivalent(ft(True), numpy.dtype(t))
3840
if name != "bool_":
3941
self.assertEquivalent(ft(int(1)), numpy.dtype(t))
40-
self.assertEquivalent(ft(long(1)), numpy.dtype(t))
42+
if sys.version_info[0] == 2:
43+
self.assertEquivalent(ft(long(1)), numpy.dtype(t))
4144

4245

4346
def testFloats(self):

0 commit comments

Comments
 (0)