diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
commit | bb726ca19f434f5055c0efceefe48d89469fcbbe (patch) | |
tree | 889782afaf67fd5acb5f222969251871c0c46e5a /numpy/testing | |
parent | 7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff) | |
download | numpy-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 'numpy/testing')
-rw-r--r-- | numpy/testing/__init__.py | 2 | ||||
-rw-r--r-- | numpy/testing/decorators.py | 2 | ||||
-rw-r--r-- | numpy/testing/noseclasses.py | 2 | ||||
-rw-r--r-- | numpy/testing/nosetester.py | 20 | ||||
-rw-r--r-- | numpy/testing/nulltester.py | 2 | ||||
-rw-r--r-- | numpy/testing/numpytest.py | 4 | ||||
-rwxr-xr-x | numpy/testing/print_coercion_tables.py | 52 | ||||
-rwxr-xr-x | numpy/testing/setup.py | 2 | ||||
-rw-r--r-- | numpy/testing/tests/test_decorators.py | 2 | ||||
-rw-r--r-- | numpy/testing/tests/test_doctesting.py | 2 | ||||
-rw-r--r-- | numpy/testing/tests/test_utils.py | 2 | ||||
-rw-r--r-- | numpy/testing/utils.py | 2 |
12 files changed, 47 insertions, 47 deletions
diff --git a/numpy/testing/__init__.py b/numpy/testing/__init__.py index cee2d6944..4265eddcf 100644 --- a/numpy/testing/__init__.py +++ b/numpy/testing/__init__.py @@ -5,7 +5,7 @@ in a single location, so that test scripts can just import it and work right away. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function from unittest import TestCase diff --git a/numpy/testing/decorators.py b/numpy/testing/decorators.py index 6d3da95ed..ac3526ea7 100644 --- a/numpy/testing/decorators.py +++ b/numpy/testing/decorators.py @@ -13,7 +13,7 @@ function name, setup and teardown functions and so on - see ``nose.tools`` for more information. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import warnings import sys diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py index f3c15b39d..5497bd9ce 100644 --- a/numpy/testing/noseclasses.py +++ b/numpy/testing/noseclasses.py @@ -4,7 +4,7 @@ # Because this module imports nose directly, it should not # be used except by nosetester.py to avoid a general NumPy # dependency on nose. -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import os import doctest diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py index 326c36cac..a7354b794 100644 --- a/numpy/testing/nosetester.py +++ b/numpy/testing/nosetester.py @@ -4,7 +4,7 @@ Nose test running. This module implements ``test()`` and ``bench()`` functions for NumPy modules. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import os import sys @@ -195,19 +195,19 @@ class NoseTester(object): nose = import_nose() import numpy - print "NumPy version %s" % numpy.__version__ + print("NumPy version %s" % numpy.__version__) npdir = os.path.dirname(numpy.__file__) - print "NumPy is installed in %s" % npdir + print("NumPy is installed in %s" % npdir) if 'scipy' in self.package_name: import scipy - print "SciPy version %s" % scipy.__version__ + print("SciPy version %s" % scipy.__version__) spdir = os.path.dirname(scipy.__file__) - print "SciPy is installed in %s" % spdir + print("SciPy is installed in %s" % spdir) pyversion = sys.version.replace('\n','') - print "Python version %s" % pyversion - print "nose version %d.%d.%d" % nose.__versioninfo__ + print("Python version %s" % pyversion) + print("nose version %d.%d.%d" % nose.__versioninfo__) def _get_custom_doctester(self): """ Return instantiated plugin for doctests @@ -335,9 +335,9 @@ class NoseTester(object): utils.verbose = verbose if doctests: - print "Running unit tests and doctests for %s" % self.package_name + print("Running unit tests and doctests for %s" % self.package_name) else: - print "Running unit tests for %s" % self.package_name + print("Running unit tests for %s" % self.package_name) self._show_system_info() @@ -437,7 +437,7 @@ class NoseTester(object): """ - print "Running benchmarks for %s" % self.package_name + print("Running benchmarks for %s" % self.package_name) self._show_system_info() argv = self._test_argv(label, verbose, extra_argv) diff --git a/numpy/testing/nulltester.py b/numpy/testing/nulltester.py index 0419f9436..d94d8ed50 100644 --- a/numpy/testing/nulltester.py +++ b/numpy/testing/nulltester.py @@ -6,7 +6,7 @@ below requirements. See pkgtester, nosetester modules """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function class NullTester(object): diff --git a/numpy/testing/numpytest.py b/numpy/testing/numpytest.py index 4e2409e8d..4fa9364b1 100644 --- a/numpy/testing/numpytest.py +++ b/numpy/testing/numpytest.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import os import sys @@ -46,7 +46,7 @@ def importall(package): try: exec('import %s as m' % (name)) except Exception as msg: - print 'Failed importing %s: %s' %(name, msg) + print('Failed importing %s: %s' %(name, msg)) continue importall(m) return diff --git a/numpy/testing/print_coercion_tables.py b/numpy/testing/print_coercion_tables.py index 829ba0a16..06c968cf4 100755 --- a/numpy/testing/print_coercion_tables.py +++ b/numpy/testing/print_coercion_tables.py @@ -2,7 +2,7 @@ """Prints type-coercion tables for the built-in NumPy types """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import numpy as np @@ -20,26 +20,26 @@ class GenericObject(object): dtype = np.dtype('O') def print_cancast_table(ntypes): - print 'X', - for char in ntypes: print char, - print + print('X', end=' ') + for char in ntypes: print(char, end=' ') + print() for row in ntypes: - print row, + print(row, end=' ') for col in ntypes: - print int(np.can_cast(row, col)), - print + print(int(np.can_cast(row, col)), end=' ') + print() def print_coercion_table(ntypes, inputfirstvalue, inputsecondvalue, firstarray, use_promote_types=False): - print '+', - for char in ntypes: print char, - print + print('+', end=' ') + for char in ntypes: print(char, end=' ') + print() for row in ntypes: if row == 'O': rowtype = GenericObject else: rowtype = np.obj2sctype(row) - print row, + print(row, end=' ') for col in ntypes: if col == 'O': coltype = GenericObject @@ -65,25 +65,25 @@ def print_coercion_table(ntypes, inputfirstvalue, inputsecondvalue, firstarray, char = '@' except TypeError: char = '#' - print char, - print + print(char, end=' ') + print() -print "can cast" +print("can cast") print_cancast_table(np.typecodes['All']) -print -print "In these tables, ValueError is '!', OverflowError is '@', TypeError is '#'" -print -print "scalar + scalar" +print() +print("In these tables, ValueError is '!', OverflowError is '@', TypeError is '#'") +print() +print("scalar + scalar") print_coercion_table(np.typecodes['All'], 0, 0, False) -print -print "scalar + neg scalar" +print() +print("scalar + neg scalar") print_coercion_table(np.typecodes['All'], 0, -1, False) -print -print "array + scalar" +print() +print("array + scalar") print_coercion_table(np.typecodes['All'], 0, 0, True) -print -print "array + neg scalar" +print() +print("array + neg scalar") print_coercion_table(np.typecodes['All'], 0, -1, True) -print -print "promote_types" +print() +print("promote_types") print_coercion_table(np.typecodes['All'], 0, 0, False, True) diff --git a/numpy/testing/setup.py b/numpy/testing/setup.py index c72dd1d9a..0e3a9627e 100755 --- a/numpy/testing/setup.py +++ b/numpy/testing/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division +from __future__ import division, print_function def configuration(parent_package='',top_path=None): diff --git a/numpy/testing/tests/test_decorators.py b/numpy/testing/tests/test_decorators.py index 0acf5a11a..f3e142d54 100644 --- a/numpy/testing/tests/test_decorators.py +++ b/numpy/testing/tests/test_decorators.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import * diff --git a/numpy/testing/tests/test_doctesting.py b/numpy/testing/tests/test_doctesting.py index 798c0e7e7..43f9fb6ce 100644 --- a/numpy/testing/tests/test_doctesting.py +++ b/numpy/testing/tests/test_doctesting.py @@ -1,7 +1,7 @@ """ Doctests for NumPy-specific nose/doctest modifications """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function # try the #random directive on the output line def check_random_directive(): diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index f08ca2b12..cbc8cd23e 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import warnings import sys diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 979894fbc..234311689 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -2,7 +2,7 @@ Utility function to facilitate testing. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import os import sys |