summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-06 13:25:26 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-06 13:25:26 -0600
commitbb726ca19f434f5055c0efceefe48d89469fcbbe (patch)
tree889782afaf67fd5acb5f222969251871c0c46e5a /doc
parent7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff)
downloadnumpy-bb726ca19f434f5055c0efceefe48d89469fcbbe.tar.gz
2to3: Apply `print` fixer.
Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/cdoc/numpyfilter.py2
-rwxr-xr-xdoc/cython/run_test.py2
-rwxr-xr-xdoc/cython/setup.py2
-rw-r--r--doc/example.py2
-rw-r--r--doc/newdtype_example/example.py6
-rw-r--r--doc/newdtype_example/floatint/__init__.py2
-rw-r--r--doc/newdtype_example/setup.py2
-rw-r--r--doc/numpybook/comparison/ctypes/filter.py2
-rw-r--r--doc/numpybook/comparison/ctypes/interface.py2
-rw-r--r--doc/numpybook/comparison/pyrex/setup.py2
-rw-r--r--doc/numpybook/comparison/timing.py6
-rw-r--r--doc/numpybook/comparison/weave/filter.py2
-rw-r--r--doc/numpybook/comparison/weave/inline.py6
-rw-r--r--doc/numpybook/runcode.py14
-rwxr-xr-xdoc/postprocess.py2
-rwxr-xr-xdoc/pyrex/run_test.py2
-rw-r--r--doc/pyrex/setup.py2
-rw-r--r--doc/source/conf.py2
-rw-r--r--doc/sphinxext/numpydoc/__init__.py2
-rw-r--r--doc/sphinxext/numpydoc/comment_eater.py2
-rw-r--r--doc/sphinxext/numpydoc/compiler_unparse.py2
-rw-r--r--doc/sphinxext/numpydoc/docscrape.py7
-rw-r--r--doc/sphinxext/numpydoc/docscrape_sphinx.py2
-rw-r--r--doc/sphinxext/numpydoc/linkcode.py2
-rw-r--r--doc/sphinxext/numpydoc/numpydoc.py2
-rw-r--r--doc/sphinxext/numpydoc/phantom_import.py2
-rw-r--r--doc/sphinxext/numpydoc/plot_directive.py2
-rw-r--r--doc/sphinxext/numpydoc/tests/test_docscrape.py2
-rw-r--r--doc/sphinxext/numpydoc/tests/test_linkcode.py2
-rw-r--r--doc/sphinxext/numpydoc/tests/test_phantom_import.py2
-rw-r--r--doc/sphinxext/numpydoc/tests/test_plot_directive.py2
-rw-r--r--doc/sphinxext/numpydoc/tests/test_traitsdoc.py2
-rw-r--r--doc/sphinxext/numpydoc/traitsdoc.py2
-rw-r--r--doc/sphinxext/setup.py2
-rwxr-xr-xdoc/summarize.py24
-rwxr-xr-xdoc/swig/test/setup.py2
-rwxr-xr-xdoc/swig/test/testArray.py8
-rwxr-xr-xdoc/swig/test/testFarray.py8
-rw-r--r--doc/swig/test/testFortran.py14
-rwxr-xr-xdoc/swig/test/testMatrix.py62
-rwxr-xr-xdoc/swig/test/testTensor.py62
-rwxr-xr-xdoc/swig/test/testVector.py70
42 files changed, 171 insertions, 176 deletions
diff --git a/doc/cdoc/numpyfilter.py b/doc/cdoc/numpyfilter.py
index d5021f92a..32c6dffcb 100755
--- a/doc/cdoc/numpyfilter.py
+++ b/doc/cdoc/numpyfilter.py
@@ -6,7 +6,7 @@ Interpret C comments as ReStructuredText, and replace them by the HTML output.
Also, add Doxygen /** and /**< syntax automatically where appropriate.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
import re
diff --git a/doc/cython/run_test.py b/doc/cython/run_test.py
index 986016c7a..5ffd7e80f 100755
--- a/doc/cython/run_test.py
+++ b/doc/cython/run_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from numpyx import test
test()
diff --git a/doc/cython/setup.py b/doc/cython/setup.py
index 0b063fef9..fe122d4db 100755
--- a/doc/cython/setup.py
+++ b/doc/cython/setup.py
@@ -5,7 +5,7 @@ Note: Cython is the successor project to Pyrex. For more information, see
http://cython.org.
"""
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
diff --git a/doc/example.py b/doc/example.py
index e01640948..71c1a2f30 100644
--- a/doc/example.py
+++ b/doc/example.py
@@ -8,7 +8,7 @@ extend over multiple lines, the closing three quotation marks must be on
a line by itself, preferably preceeded by a blank line.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import os # standard library imports first
diff --git a/doc/newdtype_example/example.py b/doc/newdtype_example/example.py
index f6251c0b9..6e9bf4334 100644
--- a/doc/newdtype_example/example.py
+++ b/doc/newdtype_example/example.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import floatint.floatint as ff
import numpy as np
@@ -12,7 +12,7 @@ g = np.array([1,2,3,4,5,6,7,8]).view(ff.floatint_type)
# Now, the elements will be the scalar type associated
# with the ndarray.
-print g[0]
-print type(g[1])
+print(g[0])
+print(type(g[1]))
# Now, you need to register ufuncs and more arrfuncs to do useful things...
diff --git a/doc/newdtype_example/floatint/__init__.py b/doc/newdtype_example/floatint/__init__.py
index b4895eb4c..ebede2753 100644
--- a/doc/newdtype_example/floatint/__init__.py
+++ b/doc/newdtype_example/floatint/__init__.py
@@ -1,3 +1,3 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
diff --git a/doc/newdtype_example/setup.py b/doc/newdtype_example/setup.py
index 2d9ed6c99..494343b28 100644
--- a/doc/newdtype_example/setup.py
+++ b/doc/newdtype_example/setup.py
@@ -1,4 +1,4 @@
-from __future__ import division
+from __future__ import division, print_function
from numpy.distutils.core import setup
diff --git a/doc/numpybook/comparison/ctypes/filter.py b/doc/numpybook/comparison/ctypes/filter.py
index 16acec04b..13d768027 100644
--- a/doc/numpybook/comparison/ctypes/filter.py
+++ b/doc/numpybook/comparison/ctypes/filter.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
__all__ = ['filter2d']
diff --git a/doc/numpybook/comparison/ctypes/interface.py b/doc/numpybook/comparison/ctypes/interface.py
index 651ee9439..34e34ca71 100644
--- a/doc/numpybook/comparison/ctypes/interface.py
+++ b/doc/numpybook/comparison/ctypes/interface.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
__all__ = ['add', 'filter2d']
diff --git a/doc/numpybook/comparison/pyrex/setup.py b/doc/numpybook/comparison/pyrex/setup.py
index f0c764955..3fb69a705 100644
--- a/doc/numpybook/comparison/pyrex/setup.py
+++ b/doc/numpybook/comparison/pyrex/setup.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
diff --git a/doc/numpybook/comparison/timing.py b/doc/numpybook/comparison/timing.py
index 59978ba35..0d47c7eba 100644
--- a/doc/numpybook/comparison/timing.py
+++ b/doc/numpybook/comparison/timing.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import timeit
@@ -54,9 +54,9 @@ path = sys.path
for kind in ['f2py']:#['ctypes', 'pyrex', 'weave', 'f2py']:
res[kind] = []
sys.path = ['/Users/oliphant/numpybook/%s' % (kind,)] + path
- print sys.path
+ print(sys.path)
for n in N:
- print "%s - %d" % (kind, n)
+ print("%s - %d" % (kind, n))
t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind,n,n)))
mytime = min(t.repeat(3,100))
res[kind].append(mytime)
diff --git a/doc/numpybook/comparison/weave/filter.py b/doc/numpybook/comparison/weave/filter.py
index 9fa726a79..bbdc9ea85 100644
--- a/doc/numpybook/comparison/weave/filter.py
+++ b/doc/numpybook/comparison/weave/filter.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from scipy import weave, zeros_like
diff --git a/doc/numpybook/comparison/weave/inline.py b/doc/numpybook/comparison/weave/inline.py
index 9c134b231..3906553ed 100644
--- a/doc/numpybook/comparison/weave/inline.py
+++ b/doc/numpybook/comparison/weave/inline.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from scipy import weave
from numpy import rand, zeros_like
@@ -40,8 +40,8 @@ def arr(a):
return b
a = [None]*10
-print example1(a)
-print a
+print(example1(a))
+print(a)
a = rand(512,512)
b = arr(a)
diff --git a/doc/numpybook/runcode.py b/doc/numpybook/runcode.py
index 858168e11..456846cad 100644
--- a/doc/numpybook/runcode.py
+++ b/doc/numpybook/runcode.py
@@ -14,7 +14,7 @@ Options:
-n name of code section (default MyCode)
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
import optparse
@@ -25,8 +25,8 @@ import os
newre = re.compile(r"\\begin_inset Note.*PYNEW\s+\\end_inset", re.DOTALL)
def getoutput(tstr, dic):
- print "\n\nRunning..."
- print tstr,
+ print("\n\nRunning...")
+ print(tstr, end=' ')
tempstr = io.StringIO()
sys.stdout = tempstr
code = compile(tstr, '<input>', 'exec')
@@ -44,8 +44,8 @@ def getoutput(tstr, dic):
else:
res = tempstr.getvalue() + '\n' + repr(res)
if res != '':
- print "\nOutput is"
- print res,
+ print("\nOutput is")
+ print(res, end=' ')
return res
# now find the code in the code segment
@@ -90,7 +90,7 @@ def runpycode(lyxstr, name='MyCode'):
num += 1
if num == 0:
- print "Nothing found for %s" % name
+ print("Nothing found for %s" % name)
return lyxstr
start = 0
@@ -141,7 +141,7 @@ def main(args):
fid = file(args[0])
str = fid.read()
fid.close()
- print "Processing %s" % options.name
+ print("Processing %s" % options.name)
newstr = runpycode(str, options.name)
fid = file(args[0],'w')
fid.write(newstr)
diff --git a/doc/postprocess.py b/doc/postprocess.py
index 195ab9d96..f0ca22cd5 100755
--- a/doc/postprocess.py
+++ b/doc/postprocess.py
@@ -6,7 +6,7 @@ Post-processes HTML and Latex files output by Sphinx.
MODE is either 'html' or 'tex'.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import re, optparse
diff --git a/doc/pyrex/run_test.py b/doc/pyrex/run_test.py
index 986016c7a..5ffd7e80f 100755
--- a/doc/pyrex/run_test.py
+++ b/doc/pyrex/run_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from numpyx import test
test()
diff --git a/doc/pyrex/setup.py b/doc/pyrex/setup.py
index 648bad9f4..361ccb183 100644
--- a/doc/pyrex/setup.py
+++ b/doc/pyrex/setup.py
@@ -12,7 +12,7 @@ http://www.scipy.org/Cookbook/Pyrex_and_NumPy
http://www.scipy.org/Cookbook/ArrayStruct_and_Pyrex
"""
-from __future__ import division
+from __future__ import division, print_function
from distutils.core import setup
from distutils.extension import Extension
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 8b29316cb..0fa905111 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, os, re
diff --git a/doc/sphinxext/numpydoc/__init__.py b/doc/sphinxext/numpydoc/__init__.py
index 9fa06e37c..0fce2cf74 100644
--- a/doc/sphinxext/numpydoc/__init__.py
+++ b/doc/sphinxext/numpydoc/__init__.py
@@ -1,3 +1,3 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
from .numpydoc import setup
diff --git a/doc/sphinxext/numpydoc/comment_eater.py b/doc/sphinxext/numpydoc/comment_eater.py
index 2c7f4da31..8b57c4b7a 100644
--- a/doc/sphinxext/numpydoc/comment_eater.py
+++ b/doc/sphinxext/numpydoc/comment_eater.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
if sys.version_info[0] >= 3:
diff --git a/doc/sphinxext/numpydoc/compiler_unparse.py b/doc/sphinxext/numpydoc/compiler_unparse.py
index c36389d13..7c2001305 100644
--- a/doc/sphinxext/numpydoc/compiler_unparse.py
+++ b/doc/sphinxext/numpydoc/compiler_unparse.py
@@ -10,7 +10,7 @@
fixme: We may want to move to using _ast trees because the compiler for
them is about 6 times faster than compiler.compile.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys
from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add
diff --git a/doc/sphinxext/numpydoc/docscrape.py b/doc/sphinxext/numpydoc/docscrape.py
index 59d3f9734..a36171855 100644
--- a/doc/sphinxext/numpydoc/docscrape.py
+++ b/doc/sphinxext/numpydoc/docscrape.py
@@ -1,9 +1,8 @@
"""Extract reference documentation from the NumPy source tree.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
-import sys
import inspect
import textwrap
import re
@@ -11,10 +10,6 @@ import pydoc
from warnings import warn
import collections
-if sys.version_info[0] >= 3:
- from io import StringIO
-else:
- from io import StringIO
class Reader(object):
"""A line-based string reader.
diff --git a/doc/sphinxext/numpydoc/docscrape_sphinx.py b/doc/sphinxext/numpydoc/docscrape_sphinx.py
index 1248253b3..d202bad34 100644
--- a/doc/sphinxext/numpydoc/docscrape_sphinx.py
+++ b/doc/sphinxext/numpydoc/docscrape_sphinx.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import re, inspect, textwrap, pydoc
import sphinx
diff --git a/doc/sphinxext/numpydoc/linkcode.py b/doc/sphinxext/numpydoc/linkcode.py
index 986f39384..1ad3ab82c 100644
--- a/doc/sphinxext/numpydoc/linkcode.py
+++ b/doc/sphinxext/numpydoc/linkcode.py
@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import warnings
import collections
diff --git a/doc/sphinxext/numpydoc/numpydoc.py b/doc/sphinxext/numpydoc/numpydoc.py
index d95d476ef..773a87d37 100644
--- a/doc/sphinxext/numpydoc/numpydoc.py
+++ b/doc/sphinxext/numpydoc/numpydoc.py
@@ -15,7 +15,7 @@ It will:
.. [1] https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sphinx
import collections
diff --git a/doc/sphinxext/numpydoc/phantom_import.py b/doc/sphinxext/numpydoc/phantom_import.py
index 855068834..9a60b4a35 100644
--- a/doc/sphinxext/numpydoc/phantom_import.py
+++ b/doc/sphinxext/numpydoc/phantom_import.py
@@ -14,7 +14,7 @@ without needing to rebuild the documented module.
.. [1] http://code.google.com/p/pydocweb
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import imp, sys, compiler, types, os, inspect, re
diff --git a/doc/sphinxext/numpydoc/plot_directive.py b/doc/sphinxext/numpydoc/plot_directive.py
index a7f4655ce..2014f8570 100644
--- a/doc/sphinxext/numpydoc/plot_directive.py
+++ b/doc/sphinxext/numpydoc/plot_directive.py
@@ -74,7 +74,7 @@ TODO
to make them appear side-by-side, or in floats.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, os, glob, shutil, imp, warnings, re, textwrap, traceback
import sphinx
diff --git a/doc/sphinxext/numpydoc/tests/test_docscrape.py b/doc/sphinxext/numpydoc/tests/test_docscrape.py
index 877d33980..60a9749ba 100644
--- a/doc/sphinxext/numpydoc/tests/test_docscrape.py
+++ b/doc/sphinxext/numpydoc/tests/test_docscrape.py
@@ -1,5 +1,5 @@
# -*- encoding:utf-8 -*-
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import sys, textwrap
diff --git a/doc/sphinxext/numpydoc/tests/test_linkcode.py b/doc/sphinxext/numpydoc/tests/test_linkcode.py
index b0c863dd6..340166a48 100644
--- a/doc/sphinxext/numpydoc/tests/test_linkcode.py
+++ b/doc/sphinxext/numpydoc/tests/test_linkcode.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.linkcode
diff --git a/doc/sphinxext/numpydoc/tests/test_phantom_import.py b/doc/sphinxext/numpydoc/tests/test_phantom_import.py
index 337db377a..173b5662b 100644
--- a/doc/sphinxext/numpydoc/tests/test_phantom_import.py
+++ b/doc/sphinxext/numpydoc/tests/test_phantom_import.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.phantom_import
diff --git a/doc/sphinxext/numpydoc/tests/test_plot_directive.py b/doc/sphinxext/numpydoc/tests/test_plot_directive.py
index 738166424..0e511fcbc 100644
--- a/doc/sphinxext/numpydoc/tests/test_plot_directive.py
+++ b/doc/sphinxext/numpydoc/tests/test_plot_directive.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.plot_directive
diff --git a/doc/sphinxext/numpydoc/tests/test_traitsdoc.py b/doc/sphinxext/numpydoc/tests/test_traitsdoc.py
index 882d6f796..d36e5ddbd 100644
--- a/doc/sphinxext/numpydoc/tests/test_traitsdoc.py
+++ b/doc/sphinxext/numpydoc/tests/test_traitsdoc.py
@@ -1,4 +1,4 @@
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import numpydoc.traitsdoc
diff --git a/doc/sphinxext/numpydoc/traitsdoc.py b/doc/sphinxext/numpydoc/traitsdoc.py
index 74c226ab4..c5f0e7912 100644
--- a/doc/sphinxext/numpydoc/traitsdoc.py
+++ b/doc/sphinxext/numpydoc/traitsdoc.py
@@ -13,7 +13,7 @@ for Traits is required.
.. [2] http://code.enthought.com/projects/traits/
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import inspect
import os
diff --git a/doc/sphinxext/setup.py b/doc/sphinxext/setup.py
index a6593aaa6..5b3454b3a 100644
--- a/doc/sphinxext/setup.py
+++ b/doc/sphinxext/setup.py
@@ -1,4 +1,4 @@
-from __future__ import division
+from __future__ import division, print_function
import setuptools
from distutils.core import setup
diff --git a/doc/summarize.py b/doc/summarize.py
index d72fcef61..a1f283be4 100755
--- a/doc/summarize.py
+++ b/doc/summarize.py
@@ -5,7 +5,7 @@ summarize.py
Show a summary about which Numpy functions are documented and which are not.
"""
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
import os, glob, re, sys, inspect, optparse
import collections
@@ -78,22 +78,22 @@ def main():
for (filename, section, keyword, toctree) in locations:
in_sections.setdefault((filename, section, keyword), []).append(name)
- print "Documented"
- print "==========\n"
+ print("Documented")
+ print("==========\n")
last_filename = None
for (filename, section, keyword), names in sorted(in_sections.items()):
if filename != last_filename:
- print "--- %s\n" % filename
+ print("--- %s\n" % filename)
last_filename = filename
- print " ** ", section
- print format_in_columns(sorted(names), options.cols)
- print "\n"
-
- print ""
- print "Undocumented"
- print "============\n"
- print format_in_columns(sorted(undocumented.keys()), options.cols)
+ print(" ** ", section)
+ print(format_in_columns(sorted(names), options.cols))
+ print("\n")
+
+ print("")
+ print("Undocumented")
+ print("============\n")
+ print(format_in_columns(sorted(undocumented.keys()), options.cols))
def check_numpy():
documented = get_documented(glob.glob(SOURCE_DIR + '/*.rst'))
diff --git a/doc/swig/test/setup.py b/doc/swig/test/setup.py
index 6395ffe46..c54b42ed4 100755
--- a/doc/swig/test/setup.py
+++ b/doc/swig/test/setup.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division
+from __future__ import division, print_function
# System imports
from distutils.core import *
diff --git a/doc/swig/test/testArray.py b/doc/swig/test/testArray.py
index 433dfb1bd..de744ce37 100755
--- a/doc/swig/test/testArray.py
+++ b/doc/swig/test/testArray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -277,8 +277,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite(Array2TestCase))
# Execute the test suite
- print "Testing Classes of Module Array"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Array")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testFarray.py b/doc/swig/test/testFarray.py
index c0699b07d..3905e26bd 100755
--- a/doc/swig/test/testFarray.py
+++ b/doc/swig/test/testFarray.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -152,8 +152,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite(FarrayTestCase))
# Execute the test suite
- print "Testing Classes of Module Farray"
- print "NumPy version", np.__version__
- print
+ print("Testing Classes of Module Farray")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testFortran.py b/doc/swig/test/testFortran.py
index 499f6a439..ae7415d50 100644
--- a/doc/swig/test/testFortran.py
+++ b/doc/swig/test/testFortran.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,14 +27,14 @@ class FortranTestCase(unittest.TestCase):
# Test (type* IN_FARRAY2, int DIM1, int DIM2) typemap
def testSecondElementContiguous(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.arange(9).reshape(3, 3).astype(self.typeCode)
self.assertEquals(second(matrix), 3)
def testSecondElementFortran(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray(np.arange(9).reshape(3, 3),
self.typeCode)
@@ -42,7 +42,7 @@ class FortranTestCase(unittest.TestCase):
def testSecondElementObject(self):
"Test luSplit function with a Fortran-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
second = Fortran.__dict__[self.typeStr + "SecondElement"]
matrix = np.asfortranarray([[0,1,2],[3,4,5],[6,7,8]], self.typeCode)
self.assertEquals(second(matrix), 3)
@@ -163,8 +163,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testMatrix.py b/doc/swig/test/testMatrix.py
index 187cd7214..d1721941e 100755
--- a/doc/swig/test/testMatrix.py
+++ b/doc/swig/test/testMatrix.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,7 +27,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDet(self):
"Test det function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7],[6,9]]
self.assertEquals(det(matrix), 30)
@@ -35,7 +35,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetBadList(self):
"Test det function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7], ["e", "pi"]]
self.assertRaises(BadListError, det, matrix)
@@ -43,7 +43,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongDim(self):
"Test det function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [8,7]
self.assertRaises(TypeError, det, matrix)
@@ -51,7 +51,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetWrongSize(self):
"Test det function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
matrix = [[8,7,6], [5,4,3], [2,1,0]]
self.assertRaises(TypeError, det, matrix)
@@ -59,14 +59,14 @@ class MatrixTestCase(unittest.TestCase):
# Test (type IN_ARRAY2[ANY][ANY]) typemap
def testDetNonContainer(self):
"Test det function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
det = Matrix.__dict__[self.typeStr + "Det"]
self.assertRaises(TypeError, det, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,5,4],[3,2,1]]
self.assertEquals(max(matrix), 6)
@@ -74,7 +74,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
matrix = [[6,"five",4], ["three", 2, "one"]]
self.assertRaises(BadListError, max, matrix)
@@ -82,21 +82,21 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY2, int DIM1, int DIM2) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Matrix.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, 1, 2, 3])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [[9,8],[7,6],[5,4]]
self.assertEquals(min(matrix), 4)
@@ -104,7 +104,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
matrix = [["nine","eight"], ["seven","six"]]
self.assertRaises(BadListError, min, matrix)
@@ -112,21 +112,21 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [1,3,5,7,9])
# Test (int DIM1, int DIM2, type* IN_ARRAY2) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Matrix.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, False)
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],self.typeCode)
scale(matrix,4)
@@ -135,7 +135,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([1,2,2,1],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -143,7 +143,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2],[2,1]],self.typeCode)
self.assertRaises(TypeError, scale, matrix)
@@ -151,7 +151,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = np.array([[1,2,3],[2,1,2],[3,2,1]],'c')
self.assertRaises(TypeError, scale, matrix)
@@ -159,7 +159,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY2[ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Matrix.__dict__[self.typeStr + "Scale"]
matrix = [[1,2,3],[2,1,2],[3,2,1]]
self.assertRaises(TypeError, scale, matrix)
@@ -167,7 +167,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7],[8,9]],self.typeCode)
floor(matrix,7)
@@ -176,7 +176,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongDim(self):
"Test floor function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([6,7,8,9],self.typeCode)
self.assertRaises(TypeError, floor, matrix)
@@ -184,7 +184,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = np.array([[6,7], [8,9]],'c')
self.assertRaises(TypeError, floor, matrix)
@@ -192,7 +192,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY2, int DIM1, int DIM2) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Matrix.__dict__[self.typeStr + "Floor"]
matrix = [[6,7], [8,9]]
self.assertRaises(TypeError, floor, matrix)
@@ -200,7 +200,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2],[3,4]],self.typeCode)
ceil(matrix,3)
@@ -209,7 +209,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([1,2,3,4],self.typeCode)
self.assertRaises(TypeError, ceil, matrix)
@@ -217,7 +217,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilWrongType(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = np.array([[1,2], [3,4]],'c')
self.assertRaises(TypeError, ceil, matrix)
@@ -225,7 +225,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, type* INPLACE_ARRAY2) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Matrix.__dict__[self.typeStr + "Ceil"]
matrix = [[1,2], [3,4]]
self.assertRaises(TypeError, ceil, matrix)
@@ -233,7 +233,7 @@ class MatrixTestCase(unittest.TestCase):
# Test (type ARGOUT_ARRAY2[ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Matrix.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[1,2,3],[4,5,6],[7,8,9]])
self.assertEquals((lower == [[1,0,0],[4,5,0],[7,8,9]]).all(), True)
@@ -355,8 +355,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 2D Functions of Module Matrix"
- print "NumPy version", np.__version__
- print
+ print("Testing 2D Functions of Module Matrix")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testTensor.py b/doc/swig/test/testTensor.py
index cd9cada46..b6dd2e98a 100755
--- a/doc/swig/test/testTensor.py
+++ b/doc/swig/test/testTensor.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -29,7 +29,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNorm(self):
"Test norm function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1], [2,3]],
[[3,2], [1,0]]]
@@ -41,7 +41,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormBadList(self):
"Test norm function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,"one"],[2,3]],
[[3,"two"],[1,0]]]
@@ -50,7 +50,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongDim(self):
"Test norm function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[0,1,2,3],
[3,2,1,0]]
@@ -59,7 +59,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormWrongSize(self):
"Test norm function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
tensor = [[[0,1,0], [2,3,2]],
[[3,2,3], [1,0,1]]]
@@ -68,14 +68,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type IN_ARRAY3[ANY][ANY][ANY]) typemap
def testNormNonContainer(self):
"Test norm function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
norm = Tensor.__dict__[self.typeStr + "Norm"]
self.assertRaises(TypeError, norm, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMax(self):
"Test max function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,2], [3,4]],
[[5,6], [7,8]]]
@@ -84,7 +84,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxBadList(self):
"Test max function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
tensor = [[[1,"two"], [3,4]],
[[5,"six"], [7,8]]]
@@ -93,21 +93,21 @@ class TensorTestCase(unittest.TestCase):
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxNonContainer(self):
"Test max function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, None)
# Test (type* IN_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testMaxWrongDim(self):
"Test max function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
max = Tensor.__dict__[self.typeStr + "Max"]
self.assertRaises(TypeError, max, [0, -1, 2, -3])
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMin(self):
"Test min function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -116,7 +116,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinBadList(self):
"Test min function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
tensor = [[["nine",8], [7,6]],
[["five",4], [3,2]]]
@@ -125,21 +125,21 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinNonContainer(self):
"Test min function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, True)
# Test (int DIM1, int DIM2, int DIM3, type* IN_ARRAY3) typemap
def testMinWrongDim(self):
"Test min function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
min = Tensor.__dict__[self.typeStr + "Min"]
self.assertRaises(TypeError, min, [[1,3],[5,7]])
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScale(self):
"Test scale function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -152,7 +152,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongType(self):
"Test scale function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0,1], [0,1,0], [1,0,1]],
[[0,1,0], [1,0,1], [0,1,0]],
@@ -162,7 +162,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongDim(self):
"Test scale function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[1,0,1], [0,1,0], [1,0,1],
[0,1,0], [1,0,1], [0,1,0]],self.typeCode)
@@ -171,7 +171,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleWrongSize(self):
"Test scale function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
tensor = np.array([[[1,0], [0,1], [1,0]],
[[0,1], [1,0], [0,1]],
@@ -181,14 +181,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
def testScaleNonArray(self):
"Test scale function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
scale = Tensor.__dict__[self.typeStr + "Scale"]
self.assertRaises(TypeError, scale, True)
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloor(self):
"Test floor function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],self.typeCode)
@@ -199,7 +199,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongType(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[[1,2], [3,4]],
[[5,6], [7,8]]],'c')
@@ -208,7 +208,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorWrongDim(self):
"Test floor function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
tensor = np.array([[1,2], [3,4], [5,6], [7,8]],self.typeCode)
self.assertRaises(TypeError, floor, tensor)
@@ -216,14 +216,14 @@ class TensorTestCase(unittest.TestCase):
# Test (type* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) typemap
def testFloorNonArray(self):
"Test floor function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
floor = Tensor.__dict__[self.typeStr + "Floor"]
self.assertRaises(TypeError, floor, object)
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeil(self):
"Test ceil function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],self.typeCode)
@@ -234,7 +234,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongType(self):
"Test ceil function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[[9,8], [7,6]],
[[5,4], [3,2]]],'c')
@@ -243,7 +243,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilWrongDim(self):
"Test ceil function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = np.array([[9,8], [7,6], [5,4], [3,2]], self.typeCode)
self.assertRaises(TypeError, ceil, tensor)
@@ -251,7 +251,7 @@ class TensorTestCase(unittest.TestCase):
# Test (int DIM1, int DIM2, int DIM3, type* INPLACE_ARRAY3) typemap
def testCeilNonArray(self):
"Test ceil function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ceil = Tensor.__dict__[self.typeStr + "Ceil"]
tensor = [[[9,8], [7,6]],
[[5,4], [3,2]]]
@@ -260,7 +260,7 @@ class TensorTestCase(unittest.TestCase):
# Test (type ARGOUT_ARRAY3[ANY][ANY][ANY]) typemap
def testLUSplit(self):
"Test luSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
luSplit = Tensor.__dict__[self.typeStr + "LUSplit"]
lower, upper = luSplit([[[1,1], [1,1]],
[[1,1], [1,1]]])
@@ -395,8 +395,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 3D Functions of Module Tensor"
- print "NumPy version", np.__version__
- print
+ print("Testing 3D Functions of Module Tensor")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))
diff --git a/doc/swig/test/testVector.py b/doc/swig/test/testVector.py
index 29a77d281..d644e464c 100755
--- a/doc/swig/test/testVector.py
+++ b/doc/swig/test/testVector.py
@@ -1,5 +1,5 @@
#! /usr/bin/env python
-from __future__ import division, absolute_import
+from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
@@ -27,98 +27,98 @@ class VectorTestCase(unittest.TestCase):
# Test the (type IN_ARRAY1[ANY]) typemap
def testLength(self):
"Test length function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertEquals(length([5, 12, 0]), 13)
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthBadList(self):
"Test length function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(BadListError, length, [5, "twelve", 0])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongSize(self):
"Test length function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [5, 12])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthWrongDim(self):
"Test length function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, [[1,2], [3,4]])
# Test the (type IN_ARRAY1[ANY]) typemap
def testLengthNonContainer(self):
"Test length function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
length = Vector.__dict__[self.typeStr + "Length"]
self.assertRaises(TypeError, length, None)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProd(self):
"Test prod function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertEquals(prod([1,2,3,4]), 24)
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdBadList(self):
"Test prod function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(BadListError, prod, [[1,"two"], ["e","pi"]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdWrongDim(self):
"Test prod function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, [[1,2], [8,9]])
# Test the (type* IN_ARRAY1, int DIM1) typemap
def testProdNonContainer(self):
"Test prod function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
prod = Vector.__dict__[self.typeStr + "Prod"]
self.assertRaises(TypeError, prod, None)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSum(self):
"Test sum function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertEquals(sum([5,6,7,8]), 26)
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumBadList(self):
"Test sum function with bad list"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(BadListError, sum, [3,4, 5, "pi"])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumWrongDim(self):
"Test sum function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, [[3,4], [5,6]])
# Test the (int DIM1, type* IN_ARRAY1) typemap
def testSumNonContainer(self):
"Test sum function with non-container"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
sum = Vector.__dict__[self.typeStr + "Sum"]
self.assertRaises(TypeError, sum, True)
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverse(self):
"Test reverse function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],self.typeCode)
reverse(vector)
@@ -127,7 +127,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongDim(self):
"Test reverse function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([[1,2], [3,4]],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -135,7 +135,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongSize(self):
"Test reverse function with wrong size"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([9,8,7,6,5,4],self.typeCode)
self.assertRaises(TypeError, reverse, vector)
@@ -143,7 +143,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseWrongType(self):
"Test reverse function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
vector = np.array([1,2,4],'c')
self.assertRaises(TypeError, reverse, vector)
@@ -151,14 +151,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type INPLACE_ARRAY1[ANY]) typemap
def testReverseNonArray(self):
"Test reverse function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
reverse = Vector.__dict__[self.typeStr + "Reverse"]
self.assertRaises(TypeError, reverse, [2,4,6])
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnes(self):
"Test ones function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros(5,self.typeCode)
ones(vector)
@@ -167,7 +167,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongDim(self):
"Test ones function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),self.typeCode)
self.assertRaises(TypeError, ones, vector)
@@ -175,7 +175,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesWrongType(self):
"Test ones function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
vector = np.zeros((5,5),'c')
self.assertRaises(TypeError, ones, vector)
@@ -183,14 +183,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* INPLACE_ARRAY1, int DIM1) typemap
def testOnesNonArray(self):
"Test ones function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
ones = Vector.__dict__[self.typeStr + "Ones"]
self.assertRaises(TypeError, ones, [2,4,6,8])
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZeros(self):
"Test zeros function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(5,self.typeCode)
zeros(vector)
@@ -199,7 +199,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongDim(self):
"Test zeros function with wrong dimensions"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones((5,5),self.typeCode)
self.assertRaises(TypeError, zeros, vector)
@@ -207,7 +207,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosWrongType(self):
"Test zeros function with wrong type"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
vector = np.ones(6,'c')
self.assertRaises(TypeError, zeros, vector)
@@ -215,14 +215,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (int DIM1, type* INPLACE_ARRAY1) typemap
def testZerosNonArray(self):
"Test zeros function with non-array"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
zeros = Vector.__dict__[self.typeStr + "Zeros"]
self.assertRaises(TypeError, zeros, [1,3,5,7,9])
# Test the (type ARGOUT_ARRAY1[ANY]) typemap
def testEOSplit(self):
"Test eoSplit function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
eoSplit = Vector.__dict__[self.typeStr + "EOSplit"]
even, odd = eoSplit([1,2,3])
self.assertEquals((even == [1,0,3]).all(), True)
@@ -231,7 +231,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwos(self):
"Test twos function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
vector = twos(5)
self.assertEquals((vector == [2,2,2,2,2]).all(), True)
@@ -239,14 +239,14 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testTwosNonInt(self):
"Test twos function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
twos = Vector.__dict__[self.typeStr + "Twos"]
self.assertRaises(TypeError, twos, 5.0)
# Test the (int DIM1, type* ARGOUT_ARRAY1) typemap
def testThrees(self):
"Test threes function"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
vector = threes(6)
self.assertEquals((vector == [3,3,3,3,3,3]).all(), True)
@@ -254,7 +254,7 @@ class VectorTestCase(unittest.TestCase):
# Test the (type* ARGOUT_ARRAY1, int DIM1) typemap
def testThreesNonInt(self):
"Test threes function with non-integer dimension"
- print >>sys.stderr, self.typeStr, "... ",
+ print(self.typeStr, "... ", end=' ', file=sys.stderr)
threes = Vector.__dict__[self.typeStr + "Threes"]
self.assertRaises(TypeError, threes, "threes")
@@ -374,8 +374,8 @@ if __name__ == "__main__":
suite.addTest(unittest.makeSuite( doubleTestCase))
# Execute the test suite
- print "Testing 1D Functions of Module Vector"
- print "NumPy version", np.__version__
- print
+ print("Testing 1D Functions of Module Vector")
+ print("NumPy version", np.__version__)
+ print()
result = unittest.TextTestRunner(verbosity=2).run(suite)
sys.exit(len(result.errors) + len(result.failures))