summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2011-04-05 21:00:10 -0600
committerCharles Harris <charlesr.harris@gmail.com>2011-04-05 21:02:29 -0600
commit966038e30b21e62ab7729527f3f0bba6e18eb805 (patch)
tree084bd7b40be49614b3770657ceaf1b539adbf964 /numpy/testing
parent4cb2eb4df95740661d7f1944451d2c1cb3482bcf (diff)
downloadnumpy-966038e30b21e62ab7729527f3f0bba6e18eb805.tar.gz
STY: Replace assert by assert_ in tests. There remain 124 uses of
assert in non-testing files that should be checked for correctness.
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/nosetester.py8
-rw-r--r--numpy/testing/utils.py7
2 files changed, 8 insertions, 7 deletions
diff --git a/numpy/testing/nosetester.py b/numpy/testing/nosetester.py
index 26118eda2..90e09f880 100644
--- a/numpy/testing/nosetester.py
+++ b/numpy/testing/nosetester.py
@@ -74,7 +74,8 @@ def run_module_suite(file_to_run = None):
if file_to_run is None:
f = sys._getframe(1)
file_to_run = f.f_locals.get('__file__', None)
- assert file_to_run is not None
+ if file_to_run is None:
+ raise AssertionError
import_nose().run(argv=['',file_to_run])
@@ -149,7 +150,8 @@ class NoseTester(object):
if package is None:
f = sys._getframe(1)
package_path = f.f_locals.get('__file__', None)
- assert package_path is not None
+ if package_path is None:
+ raise AssertionError
package_path = os.path.dirname(package_path)
package_name = f.f_locals.get('__name__', None)
elif isinstance(package, type(os)):
@@ -202,7 +204,7 @@ class NoseTester(object):
print "nose version %d.%d.%d" % nose.__versioninfo__
- def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
+ def prepare_test_args(self, label='fast', verbose=1, extra_argv=None,
doctests=False, coverage=False):
"""
Run tests for module using nose.
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index a2d3119c5..423c75527 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -341,9 +341,8 @@ def print_assert_equal(test_string,actual,desired):
"""
import pprint
- try:
- assert(actual == desired)
- except AssertionError:
+
+ if not (actual == desired):
import cStringIO
msg = cStringIO.StringIO()
msg.write(test_string)
@@ -1117,7 +1116,7 @@ def _assert_valid_refcount(op):
for j in range(15):
d = op(b,c)
- assert(sys.getrefcount(i) >= rc)
+ assert_(sys.getrefcount(i) >= rc)
def assert_allclose(actual, desired, rtol=1e-7, atol=0,
err_msg='', verbose=True):