summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_regression.py18
-rw-r--r--numpy/lib/tests/test__datasource.py30
2 files changed, 24 insertions, 24 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 2cc414744..3fbbb71df 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -160,8 +160,8 @@ class TestRegression(TestCase):
yb = ((b>2) & (b<6))
assert_array_almost_equal(xa,ya.nonzero())
assert_array_almost_equal(xb,yb.nonzero())
- assert(np.all(a[ya] > 0.5))
- assert(np.all(b[yb] > 0.5))
+ assert_(np.all(a[ya] > 0.5))
+ assert_(np.all(b[yb] > 0.5))
def test_mem_dot(self,level=rlevel):
"""Ticket #106"""
@@ -183,7 +183,7 @@ class TestRegression(TestCase):
# """Ticket #112"""
# if np.longfloat(0).itemsize > 8:
# a = np.exp(np.array([1000],dtype=np.longfloat))
-# assert(str(a)[1:9] == str(a[0])[:8])
+# assert_(str(a)[1:9] == str(a[0])[:8])
def test_argmax(self,level=rlevel):
"""Ticket #119"""
@@ -207,8 +207,8 @@ class TestRegression(TestCase):
"""Ticket #133"""
a = np.array([3])
b = np.array(3)
- assert(type(a.squeeze()) is np.ndarray)
- assert(type(b.squeeze()) is np.ndarray)
+ assert_(type(a.squeeze()) is np.ndarray)
+ assert_(type(b.squeeze()) is np.ndarray)
def test_add_identity(self,level=rlevel):
"""Ticket #143"""
@@ -347,7 +347,7 @@ class TestRegression(TestCase):
dt = np.dtype([('one', '<i4'),('two', '<i4')])
x = np.array((1,2), dtype=dt)
x = x.byteswap()
- assert(x['one'] > 1 and x['two'] > 2)
+ assert_(x['one'] > 1 and x['two'] > 2)
def test_method_args(self, level=rlevel):
# Make sure methods and functions have same default axis
@@ -488,7 +488,7 @@ class TestRegression(TestCase):
np.rec.array([(1,2),(3,4)]),
np.rec.fromarrays([(1,2),(3,4)],"i4,i4"),
np.rec.fromarrays([(1,2),(3,4)])]:
- assert(a.dtype in [dt0,dt1])
+ assert_(a.dtype in [dt0,dt1])
def test_random_shuffle(self, level=rlevel):
"""Ticket #374"""
@@ -990,8 +990,8 @@ class TestRegression(TestCase):
buf = np.zeros(40, dtype=np.int8)
a = np.recarray(2, formats="i4,f8,f8", names="id,x,y", buf=buf)
b = a.tolist()
- assert( a[0].tolist() == b[0])
- assert( a[1].tolist() == b[1])
+ assert_( a[0].tolist() == b[0])
+ assert_( a[1].tolist() == b[1])
def test_char_array_creation(self, level=rlevel):
a = np.array('123', dtype='c')
diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py
index 29dbb7ae5..a4a490ed2 100644
--- a/numpy/lib/tests/test__datasource.py
+++ b/numpy/lib/tests/test__datasource.py
@@ -150,7 +150,7 @@ class TestDataSourceExists(TestCase):
del self.ds
def test_ValidHTTP(self):
- assert self.ds.exists(valid_httpurl())
+ assert_(self.ds.exists(valid_httpurl()))
def test_InvalidHTTP(self):
self.assertEqual(self.ds.exists(invalid_httpurl()), False)
@@ -158,11 +158,11 @@ class TestDataSourceExists(TestCase):
def test_ValidFile(self):
# Test valid file in destpath
tmpfile = valid_textfile(self.tmpdir)
- assert self.ds.exists(tmpfile)
+ assert_(self.ds.exists(tmpfile))
# Test valid local file not in destpath
localdir = mkdtemp()
tmpfile = valid_textfile(localdir)
- assert self.ds.exists(tmpfile)
+ assert_(self.ds.exists(tmpfile))
rmtree(localdir)
def test_InvalidFile(self):
@@ -214,13 +214,13 @@ class TestDataSourceAbspath(TestCase):
tmp_path = lambda x: os.path.abspath(self.ds.abspath(x))
- assert tmp_path(valid_httpurl()).startswith(self.tmpdir)
- assert tmp_path(invalid_httpurl()).startswith(self.tmpdir)
- assert tmp_path(tmpfile).startswith(self.tmpdir)
- assert tmp_path(tmpfilename).startswith(self.tmpdir)
+ assert_(tmp_path(valid_httpurl()).startswith(self.tmpdir))
+ assert_(tmp_path(invalid_httpurl()).startswith(self.tmpdir))
+ assert_(tmp_path(tmpfile).startswith(self.tmpdir))
+ assert_(tmp_path(tmpfilename).startswith(self.tmpdir))
for fn in malicious_files:
- assert tmp_path(http_path+fn).startswith(self.tmpdir)
- assert tmp_path(fn).startswith(self.tmpdir)
+ assert_(tmp_path(http_path+fn).startswith(self.tmpdir))
+ assert_(tmp_path(fn).startswith(self.tmpdir))
def test_windows_os_sep(self):
orig_os_sep = os.sep
@@ -253,10 +253,10 @@ class TestRepositoryAbspath(TestCase):
def test_sandboxing(self):
tmp_path = lambda x: os.path.abspath(self.repos.abspath(x))
- assert tmp_path(valid_httpfile()).startswith(self.tmpdir)
+ assert_(tmp_path(valid_httpfile()).startswith(self.tmpdir))
for fn in malicious_files:
- assert tmp_path(http_path+fn).startswith(self.tmpdir)
- assert tmp_path(fn).startswith(self.tmpdir)
+ assert_(tmp_path(http_path+fn).startswith(self.tmpdir))
+ assert_(tmp_path(fn).startswith(self.tmpdir))
def test_windows_os_sep(self):
orig_os_sep = os.sep
@@ -280,14 +280,14 @@ class TestRepositoryExists(TestCase):
def test_ValidFile(self):
# Create local temp file
tmpfile = valid_textfile(self.tmpdir)
- assert self.repos.exists(tmpfile)
+ assert_(self.repos.exists(tmpfile))
def test_InvalidFile(self):
tmpfile = invalid_textfile(self.tmpdir)
self.assertEqual(self.repos.exists(tmpfile), False)
def test_RemoveHTTPFile(self):
- assert self.repos.exists(valid_httpurl())
+ assert_(self.repos.exists(valid_httpurl()))
def test_CachedHTTPFile(self):
localfile = valid_httpurl()
@@ -298,7 +298,7 @@ class TestRepositoryExists(TestCase):
local_path = os.path.join(self.repos._destpath, netloc)
os.mkdir(local_path, 0700)
tmpfile = valid_textfile(local_path)
- assert self.repos.exists(tmpfile)
+ assert_(self.repos.exists(tmpfile))
class TestOpenFunc(TestCase):
def setUp(self):