summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-11 14:31:52 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-13 07:43:56 -0600
commit7f5af37e26ba2e99ad3ee6928b78437f601e96e0 (patch)
tree1b210bb7361ce691e781884bf06f89c7ebd13360 /numpy/f2py
parent74b08b3f0284d9d2dd55a15dd98a3846913b1b51 (diff)
downloadnumpy-7f5af37e26ba2e99ad3ee6928b78437f601e96e0.tar.gz
2to3: Apply the `numliterals` fixer and skip the `long` fixer.
The numliterals fixer replaces the old style octal number like '01' by '0o1' removes the 'L' suffix. Octal values were previously mistakenly specified in some dates, those uses have been corrected by removing the leading zeros. Simply Removing the 'L' suffix should not be a problem, but in some testing code it looks neccesary, so in those places the Python long constructor is used instead. The 'long' type is no longer defined in Python 3. Because we need to have it defined for Python 2 it is added to numpy/compat/np3k.py where it is defined as 'int' for Python 3 and 'long' for Python 2. The `long` fixer then needs to be skipped so that it doesn't undo the good work. Closes #3074, #3067.
Diffstat (limited to 'numpy/f2py')
-rw-r--r--numpy/f2py/tests/test_return_complex.py5
-rw-r--r--numpy/f2py/tests/test_return_integer.py5
-rw-r--r--numpy/f2py/tests/test_return_logical.py5
-rw-r--r--numpy/f2py/tests/test_return_real.py5
4 files changed, 12 insertions, 8 deletions
diff --git a/numpy/f2py/tests/test_return_complex.py b/numpy/f2py/tests/test_return_complex.py
index afbe2a4f2..f03416648 100644
--- a/numpy/f2py/tests/test_return_complex.py
+++ b/numpy/f2py/tests/test_return_complex.py
@@ -2,6 +2,7 @@ from __future__ import division, absolute_import, print_function
from numpy.testing import *
from numpy import array
+from numpy.compat import long
import util
class TestReturnComplex(util.F2PyTest):
@@ -13,7 +14,7 @@ class TestReturnComplex(util.F2PyTest):
err = 0.0
assert_( abs(t(234j)-234.0j)<=err)
assert_( abs(t(234.6)-234.6)<=err)
- assert_( abs(t(234l)-234.0)<=err)
+ assert_( abs(t(long(234))-234.0)<=err)
assert_( abs(t(234.6+3j)-(234.6+3j))<=err)
#assert_( abs(t('234')-234.)<=err)
#assert_( abs(t('234.6')-234.6)<=err)
@@ -44,7 +45,7 @@ class TestReturnComplex(util.F2PyTest):
assert_raises(TypeError, t, {})
try:
- r = t(10l**400)
+ r = t(10**400)
assert_( repr(r) in ['(inf+0j)','(Infinity+0j)'],repr(r))
except OverflowError:
pass
diff --git a/numpy/f2py/tests/test_return_integer.py b/numpy/f2py/tests/test_return_integer.py
index 81ad4960b..d19653f4d 100644
--- a/numpy/f2py/tests/test_return_integer.py
+++ b/numpy/f2py/tests/test_return_integer.py
@@ -2,13 +2,14 @@ from __future__ import division, absolute_import, print_function
from numpy.testing import *
from numpy import array
+from numpy.compat import long
import util
class TestReturnInteger(util.F2PyTest):
def check_function(self, t):
assert_( t(123)==123,repr(t(123)))
assert_( t(123.6)==123)
- assert_( t(123l)==123)
+ assert_( t(long(123))==123)
assert_( t('123')==123)
assert_( t(-123)==-123)
assert_( t([123])==123)
@@ -34,7 +35,7 @@ class TestReturnInteger(util.F2PyTest):
assert_raises(Exception, t, {})
if t.__doc__.split()[0] in ['t8','s8']:
- assert_raises(OverflowError, t, 100000000000000000000000l)
+ assert_raises(OverflowError, t, 100000000000000000000000)
assert_raises(OverflowError, t, 10000000011111111111111.23)
class TestF77ReturnInteger(TestReturnInteger):
diff --git a/numpy/f2py/tests/test_return_logical.py b/numpy/f2py/tests/test_return_logical.py
index 43764a558..3823e5642 100644
--- a/numpy/f2py/tests/test_return_logical.py
+++ b/numpy/f2py/tests/test_return_logical.py
@@ -2,6 +2,7 @@ from __future__ import division, absolute_import, print_function
from numpy.testing import *
from numpy import array
+from numpy.compat import long
import util
class TestReturnLogical(util.F2PyTest):
@@ -15,7 +16,7 @@ class TestReturnLogical(util.F2PyTest):
assert_( t(1j)==1)
assert_( t(234)==1)
assert_( t(234.6)==1)
- assert_( t(234l)==1)
+ assert_( t(long(234))==1)
assert_( t(234.6+3j)==1)
assert_( t('234')==1)
assert_( t('aaa')==1)
@@ -25,7 +26,7 @@ class TestReturnLogical(util.F2PyTest):
assert_( t({})==0)
assert_( t(t)==1)
assert_( t(-234)==1)
- assert_( t(10l**100)==1)
+ assert_( t(10**100)==1)
assert_( t([234])==1)
assert_( t((234,))==1)
assert_( t(array(234))==1)
diff --git a/numpy/f2py/tests/test_return_real.py b/numpy/f2py/tests/test_return_real.py
index e741e9581..3286e11f2 100644
--- a/numpy/f2py/tests/test_return_real.py
+++ b/numpy/f2py/tests/test_return_real.py
@@ -2,6 +2,7 @@ from __future__ import division, absolute_import, print_function
from numpy.testing import *
from numpy import array
+from numpy.compat import long
import math
import util
@@ -13,7 +14,7 @@ class TestReturnReal(util.F2PyTest):
err = 0.0
assert_( abs(t(234)-234.0)<=err)
assert_( abs(t(234.6)-234.6)<=err)
- assert_( abs(t(234l)-234.0)<=err)
+ assert_( abs(t(long(234))-234.0)<=err)
assert_( abs(t('234')-234)<=err)
assert_( abs(t('234.6')-234.6)<=err)
assert_( abs(t(-234)+234)<=err)
@@ -42,7 +43,7 @@ class TestReturnReal(util.F2PyTest):
assert_raises(Exception, t, {})
try:
- r = t(10l**400)
+ r = t(10**400)
assert_( repr(r) in ['inf','Infinity'],repr(r))
except OverflowError:
pass