diff options
author | rgommers <ralf.gommers@googlemail.com> | 2011-03-01 16:51:53 +0800 |
---|---|---|
committer | rgommers <ralf.gommers@googlemail.com> | 2011-03-02 16:29:23 +0800 |
commit | 788356d6b7562749f76146d1c4bb05ba2344c865 (patch) | |
tree | a981ddbda7f67ef457485b2db6017854c981731d /numpy/lib/tests/test_regression.py | |
parent | 390dd85b17a842852e93acb20f94abfbfa37c966 (diff) | |
download | numpy-788356d6b7562749f76146d1c4bb05ba2344c865.tar.gz |
TST: clean up some ResourceWarnings from python 3.2.
Also make the sys.stdout temporary redirection in one of the tests a little
more robust. That is still necessary, because np.who is very noisy.
Diffstat (limited to 'numpy/lib/tests/test_regression.py')
-rw-r--r-- | numpy/lib/tests/test_regression.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py index a67355957..0e63fb08c 100644 --- a/numpy/lib/tests/test_regression.py +++ b/numpy/lib/tests/test_regression.py @@ -70,8 +70,8 @@ class TestRegression(TestCase): """Ticket #554""" x = np.poly1d([1,2,3]) y = np.poly1d([3,4]) - assert x != y - assert x == x + assert_(x != y) + assert_(x == x) def test_mem_insert(self, level=rlevel): """Ticket #572""" @@ -152,19 +152,21 @@ class TestRegression(TestCase): def test_void_coercion(self, level=rlevel): dt = np.dtype([('a','f4'),('b','i4')]) x = np.zeros((1,),dt) - assert(np.r_[x,x].dtype == dt) + assert_(np.r_[x,x].dtype == dt) def test_who_with_0dim_array(self, level=rlevel) : """ticket #1243""" import os, sys + oldstdout = sys.stdout sys.stdout = open(os.devnull, 'w') - try : - tmp = np.who({'foo' : np.array(1)}) - sys.stdout = sys.__stdout__ - except : - sys.stdout = sys.__stdout__ - raise AssertionError("ticket #1243") + try: + try: + tmp = np.who({'foo' : np.array(1)}) + except: + raise AssertionError("ticket #1243") + finally: + sys.stdout = oldstdout def test_bincount_empty(self): """Ticket #1387: empty array as input for bincount.""" @@ -178,8 +180,8 @@ class TestRegression(TestCase): include_dirs = [np.get_include(), np.get_numarray_include(), np.get_numpy_include()] for path in include_dirs: - assert isinstance(path, (str, unicode)) - assert path != '' + assert_(isinstance(path, (str, unicode))) + assert_(path != '') def test_polyder_return_type(self): """Ticket #1249""" |