diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2017-07-17 20:48:08 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2017-07-24 13:00:29 -0600 |
commit | ebd1df4ac3021ae86d4ee433fc80ec617cec97a4 (patch) | |
tree | 75723e4ad06936a404a7f49660ab04ccef91298c /numpy | |
parent | d58ebd235785a8cb2d9e417b6a029cf60c0fa3be (diff) | |
download | numpy-ebd1df4ac3021ae86d4ee433fc80ec617cec97a4.tar.gz |
TST: Remove unittest dependencies in numpy/tests.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/tests/test_ctypeslib.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py index 2c58f1184..e8043d057 100644 --- a/numpy/tests/test_ctypeslib.py +++ b/numpy/tests/test_ctypeslib.py @@ -5,7 +5,7 @@ import sys import numpy as np from numpy.ctypeslib import ndpointer, load_library from numpy.distutils.misc_util import get_shared_lib_extension -from numpy.testing import TestCase, run_module_suite, dec +from numpy.testing import run_module_suite, assert_, assert_raises, dec try: cdll = None @@ -20,7 +20,7 @@ try: except ImportError: _HAS_CTYPE = False -class TestLoadLibrary(TestCase): +class TestLoadLibrary(object): @dec.skipif(not _HAS_CTYPE, "ctypes not available on this python installation") @dec.knownfailureif(sys.platform == @@ -53,65 +53,65 @@ class TestLoadLibrary(TestCase): " (import error was: %s)" % str(e)) print(msg) -class TestNdpointer(TestCase): +class TestNdpointer(object): def test_dtype(self): dt = np.intc p = ndpointer(dtype=dt) - self.assertTrue(p.from_param(np.array([1], dt))) + assert_(p.from_param(np.array([1], dt))) dt = '<i4' p = ndpointer(dtype=dt) - self.assertTrue(p.from_param(np.array([1], dt))) + assert_(p.from_param(np.array([1], dt))) dt = np.dtype('>i4') p = ndpointer(dtype=dt) p.from_param(np.array([1], dt)) - self.assertRaises(TypeError, p.from_param, + assert_raises(TypeError, p.from_param, np.array([1], dt.newbyteorder('swap'))) dtnames = ['x', 'y'] dtformats = [np.intc, np.float64] dtdescr = {'names': dtnames, 'formats': dtformats} dt = np.dtype(dtdescr) p = ndpointer(dtype=dt) - self.assertTrue(p.from_param(np.zeros((10,), dt))) + assert_(p.from_param(np.zeros((10,), dt))) samedt = np.dtype(dtdescr) p = ndpointer(dtype=samedt) - self.assertTrue(p.from_param(np.zeros((10,), dt))) + assert_(p.from_param(np.zeros((10,), dt))) dt2 = np.dtype(dtdescr, align=True) if dt.itemsize != dt2.itemsize: - self.assertRaises(TypeError, p.from_param, np.zeros((10,), dt2)) + assert_raises(TypeError, p.from_param, np.zeros((10,), dt2)) else: - self.assertTrue(p.from_param(np.zeros((10,), dt2))) + assert_(p.from_param(np.zeros((10,), dt2))) def test_ndim(self): p = ndpointer(ndim=0) - self.assertTrue(p.from_param(np.array(1))) - self.assertRaises(TypeError, p.from_param, np.array([1])) + assert_(p.from_param(np.array(1))) + assert_raises(TypeError, p.from_param, np.array([1])) p = ndpointer(ndim=1) - self.assertRaises(TypeError, p.from_param, np.array(1)) - self.assertTrue(p.from_param(np.array([1]))) + assert_raises(TypeError, p.from_param, np.array(1)) + assert_(p.from_param(np.array([1]))) p = ndpointer(ndim=2) - self.assertTrue(p.from_param(np.array([[1]]))) + assert_(p.from_param(np.array([[1]]))) def test_shape(self): p = ndpointer(shape=(1, 2)) - self.assertTrue(p.from_param(np.array([[1, 2]]))) - self.assertRaises(TypeError, p.from_param, np.array([[1], [2]])) + assert_(p.from_param(np.array([[1, 2]]))) + assert_raises(TypeError, p.from_param, np.array([[1], [2]])) p = ndpointer(shape=()) - self.assertTrue(p.from_param(np.array(1))) + assert_(p.from_param(np.array(1))) def test_flags(self): x = np.array([[1, 2], [3, 4]], order='F') p = ndpointer(flags='FORTRAN') - self.assertTrue(p.from_param(x)) + assert_(p.from_param(x)) p = ndpointer(flags='CONTIGUOUS') - self.assertRaises(TypeError, p.from_param, x) + assert_raises(TypeError, p.from_param, x) p = ndpointer(flags=x.flags.num) - self.assertTrue(p.from_param(x)) - self.assertRaises(TypeError, p.from_param, np.array([[1, 2], [3, 4]])) + assert_(p.from_param(x)) + assert_raises(TypeError, p.from_param, np.array([[1, 2], [3, 4]])) def test_cache(self): a1 = ndpointer(dtype=np.float64) a2 = ndpointer(dtype=np.float64) - self.assertEqual(a1, a2) + assert_(a1 == a2) if __name__ == "__main__": |