diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-04-04 10:33:07 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2018-04-06 18:20:56 -0600 |
commit | 7bf0564f87511d9e7b6287b3eec0857d0d7742df (patch) | |
tree | 0f61ebbad4144e802a8966015741b2d309be696e | |
parent | 036151143bff1eebeded5582534e676a192352cd (diff) | |
download | numpy-7bf0564f87511d9e7b6287b3eec0857d0d7742df.tar.gz |
MAINT: Remove all uses of run_module_suite.
That function is nose specific and has not worked since `__init__` files
were added to the tests directories.
123 files changed, 194 insertions, 704 deletions
diff --git a/numpy/compat/tests/test_compat.py b/numpy/compat/tests/test_compat.py index b91971d38..1543aafaf 100644 --- a/numpy/compat/tests/test_compat.py +++ b/numpy/compat/tests/test_compat.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function from os.path import join from numpy.compat import isfileobj -from numpy.testing import assert_, run_module_suite +from numpy.testing import assert_ from numpy.testing import tempdir @@ -19,7 +19,3 @@ def test_isfileobj(): with open(filename, 'rb') as f: assert_(isfileobj(f)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_abc.py b/numpy/core/tests/test_abc.py index 77cf40620..d9c61b0c6 100644 --- a/numpy/core/tests/test_abc.py +++ b/numpy/core/tests/test_abc.py @@ -1,6 +1,6 @@ from __future__ import division, absolute_import, print_function -from numpy.testing import assert_, run_module_suite +from numpy.testing import assert_ import numbers @@ -54,7 +54,3 @@ class TestABC(object): "{0} is not instance of Integral".format(t.__name__)) assert_(issubclass(t, numbers.Integral), "{0} is not subclass of Integral".format(t.__name__)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_api.py b/numpy/core/tests/test_api.py index 10c2d5421..a927968a4 100644 --- a/numpy/core/tests/test_api.py +++ b/numpy/core/tests/test_api.py @@ -4,9 +4,8 @@ import sys import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_raises, HAS_REFCOUNT -) + assert_, assert_equal, assert_array_equal, assert_raises, HAS_REFCOUNT + ) # Switch between new behaviour when NPY_RELAXED_STRIDES_CHECKING is set. NPY_RELAXED_STRIDES_CHECKING = np.ones((10, 1), order='C').flags.f_contiguous @@ -512,6 +511,3 @@ def test_broadcast_arrays(): result = np.broadcast_arrays(a, b) assert_equal(result[0], np.array([(1, 2, 3), (1, 2, 3), (1, 2, 3)], dtype='u4,u4,u4')) assert_equal(result[1], np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], dtype='u4,u4,u4')) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py index 189eabf9b..2c142f82b 100644 --- a/numpy/core/tests/test_arrayprint.py +++ b/numpy/core/tests/test_arrayprint.py @@ -7,8 +7,7 @@ import pytest import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, assert_warns, - HAS_REFCOUNT, + assert_, assert_equal, assert_raises, assert_warns, HAS_REFCOUNT, ) import textwrap @@ -872,7 +871,3 @@ class TestContextManager(object): with np.printoptions(**opts) as ctx: saved_opts = ctx.copy() assert_equal({k: saved_opts[k] for k in opts}, opts) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_datetime.py b/numpy/core/tests/test_datetime.py index f660d8869..dca2d2541 100644 --- a/numpy/core/tests/test_datetime.py +++ b/numpy/core/tests/test_datetime.py @@ -7,9 +7,8 @@ import numpy as np import datetime import pytest from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_warns, suppress_warnings -) + assert_, assert_equal, assert_raises, assert_warns, suppress_warnings + ) # Use pytz to test out various time zones if available try: @@ -1979,6 +1978,3 @@ class TestDateTimeData(object): def test_basic(self): a = np.array(['1980-03-23'], dtype=np.datetime64) assert_equal(np.datetime_data(a.dtype), ('D', 1)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_defchararray.py b/numpy/core/tests/test_defchararray.py index 436643899..43f1b71c7 100644 --- a/numpy/core/tests/test_defchararray.py +++ b/numpy/core/tests/test_defchararray.py @@ -5,9 +5,9 @@ import sys import numpy as np from numpy.core.multiarray import _vec_string from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, assert_raises, + assert_, assert_equal, assert_array_equal, assert_raises, suppress_warnings, -) + ) kw_unicode_true = {'unicode': True} # make 2to3 work properly kw_unicode_false = {'unicode': False} @@ -700,7 +700,3 @@ def test_empty_indexing(): # empty chararray instead of a chararray with a single empty string in it. s = np.chararray((4,)) assert_(s[[]].size == 0) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index f055b5fcd..5d59d8226 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -13,8 +13,9 @@ import pytest import numpy as np from numpy.testing import ( - run_module_suite, assert_raises, assert_warns, assert_no_warnings, - assert_array_equal, assert_) + assert_raises, assert_warns, assert_no_warnings, assert_array_equal, + assert_ + ) try: import pytz @@ -487,7 +488,3 @@ class TestGeneratorSum(_DeprecationTestCase): # 2018-02-25, 1.15.0 def test_generator_sum(self): self.assert_deprecated(np.sum, args=((i for i in range(5)),)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py index f8a724832..35b8f6868 100644 --- a/numpy/core/tests/test_dtype.py +++ b/numpy/core/tests/test_dtype.py @@ -7,9 +7,7 @@ import pytest import numpy as np from numpy.core._rational_tests import rational -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises -) +from numpy.testing import assert_, assert_equal, assert_raises def assert_dtype_equal(a, b): assert_equal(a, b) @@ -722,7 +720,3 @@ def test_dtypes_are_true(): def test_invalid_dtype_string(): # test for gh-10440 assert_raises(TypeError, np.dtype, 'f8,i8,[f8,i8]') - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_einsum.py b/numpy/core/tests/test_einsum.py index 406b10eab..792b9e0a2 100644 --- a/numpy/core/tests/test_einsum.py +++ b/numpy/core/tests/test_einsum.py @@ -4,8 +4,8 @@ import itertools import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_almost_equal, assert_raises, suppress_warnings + assert_, assert_equal, assert_array_equal, assert_almost_equal, + assert_raises, suppress_warnings ) # Setup for optimize einsum @@ -932,7 +932,3 @@ class TestEinSumPath(object): for sp in itertools.product(['', ' '], repeat=4): # no error for any spacing np.einsum('{}...a{}->{}...a{}'.format(*sp), arr) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_errstate.py b/numpy/core/tests/test_errstate.py index 212073362..4f6111921 100644 --- a/numpy/core/tests/test_errstate.py +++ b/numpy/core/tests/test_errstate.py @@ -4,7 +4,7 @@ import platform import pytest import numpy as np -from numpy.testing import assert_, run_module_suite +from numpy.testing import assert_ class TestErrstate(object): @@ -47,7 +47,3 @@ class TestErrstate(object): with np.errstate(call=None): assert_(np.geterrcall() is None, 'call is not None') assert_(np.geterrcall() is olderrcall, 'call is not olderrcall') - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_extint128.py b/numpy/core/tests/test_extint128.py index b041fb0d5..0e9c07fd5 100644 --- a/numpy/core/tests/test_extint128.py +++ b/numpy/core/tests/test_extint128.py @@ -221,7 +221,3 @@ def test_ceildiv_128_64(): if c != d: assert_equal(d, c) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_function_base.py b/numpy/core/tests/test_function_base.py index bffe5237a..d0ff1c15f 100644 --- a/numpy/core/tests/test_function_base.py +++ b/numpy/core/tests/test_function_base.py @@ -1,11 +1,13 @@ from __future__ import division, absolute_import, print_function -from numpy import (logspace, linspace, geomspace, dtype, array, sctypes, - arange, isnan, ndarray, sqrt, nextafter) +from numpy import ( + logspace, linspace, geomspace, dtype, array, sctypes, arange, isnan, + ndarray, sqrt, nextafter + ) from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_array_equal, assert_allclose, suppress_warnings -) + assert_, assert_equal, assert_raises, assert_array_equal, assert_allclose, + suppress_warnings + ) class PhysicalQuantity(float): @@ -319,7 +321,3 @@ class TestLinspace(object): assert_(isinstance(y, tuple) and len(y) == 2 and len(y[0]) == num and isnan(y[1]), 'num={0}, endpoint={1}'.format(num, ept)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_getlimits.py b/numpy/core/tests/test_getlimits.py index 455f5257c..ca8093c62 100644 --- a/numpy/core/tests/test_getlimits.py +++ b/numpy/core/tests/test_getlimits.py @@ -6,11 +6,11 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.core import finfo, iinfo from numpy import half, single, double, longdouble -from numpy.testing import ( - run_module_suite, assert_equal, assert_, assert_raises -) -from numpy.core.getlimits import (_discovered_machar, _float16_ma, _float32_ma, - _float64_ma, _float128_ma, _float80_ma) +from numpy.testing import assert_equal, assert_, assert_raises +from numpy.core.getlimits import ( + _discovered_machar, _float16_ma, _float32_ma, _float64_ma, _float128_ma, + _float80_ma + ) ################################################## @@ -124,7 +124,3 @@ def test_plausible_finfo(): assert_(info.nmant > 1) assert_(info.minexp < -1) assert_(info.maxexp > 1) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_half.py b/numpy/core/tests/test_half.py index 080f136a5..b02f6cae2 100644 --- a/numpy/core/tests/test_half.py +++ b/numpy/core/tests/test_half.py @@ -5,7 +5,7 @@ import pytest import numpy as np from numpy import uint16, float16, float32, float64 -from numpy.testing import run_module_suite, assert_, assert_equal +from numpy.testing import assert_, assert_equal def assert_raises_fpe(strmatch, callable, *args, **kwargs): @@ -433,7 +433,3 @@ class TestHalf(object): c = np.array(b) assert_(c.dtype == float16) assert_equal(a, c) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_indexerrors.py b/numpy/core/tests/test_indexerrors.py index 50919ffec..63b43c473 100644 --- a/numpy/core/tests/test_indexerrors.py +++ b/numpy/core/tests/test_indexerrors.py @@ -1,7 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import run_module_suite, assert_raises +from numpy.testing import assert_raises class TestIndexErrors(object): '''Tests to exercise indexerrors not covered by other tests.''' @@ -121,6 +121,3 @@ class TestIndexErrors(object): a = np.zeros((0, 3)) assert_raises(IndexError, lambda: a.item(100)) assert_raises(IndexError, lambda: a.itemset(100, 1)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py index 01330ac55..65852e577 100644 --- a/numpy/core/tests/test_indexing.py +++ b/numpy/core/tests/test_indexing.py @@ -10,9 +10,9 @@ import numpy as np from numpy.core._multiarray_tests import array_indexing from itertools import product from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_array_equal, assert_warns, HAS_REFCOUNT, suppress_warnings, -) + assert_, assert_equal, assert_raises, assert_array_equal, assert_warns, + HAS_REFCOUNT, suppress_warnings, + ) class TestIndexing(object): @@ -1299,7 +1299,3 @@ class TestCApiAccess(object): a = a.reshape(5, 2) assign(a, 4, 10) assert_array_equal(a[-1], [10, 10]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_item_selection.py b/numpy/core/tests/test_item_selection.py index 642da426c..3bc24fc95 100644 --- a/numpy/core/tests/test_item_selection.py +++ b/numpy/core/tests/test_item_selection.py @@ -4,9 +4,8 @@ import sys import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_raises, - assert_array_equal, HAS_REFCOUNT -) + assert_, assert_raises, assert_array_equal, HAS_REFCOUNT + ) class TestTake(object): @@ -86,7 +85,3 @@ class TestTake(object): b = np.array([0, 1, 2, 3, 4, 5]) assert_array_equal(a, b) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_longdouble.py b/numpy/core/tests/test_longdouble.py index 302bfe9ec..513a71b99 100644 --- a/numpy/core/tests/test_longdouble.py +++ b/numpy/core/tests/test_longdouble.py @@ -4,9 +4,8 @@ import pytest import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_array_equal, temppath, -) + assert_, assert_equal, assert_raises, assert_array_equal, temppath, + ) from ._locales import CommaDecimalPointLocale LD_INFO = np.finfo(np.longdouble) @@ -206,7 +205,3 @@ class TestCommaDecimalPointLocale(CommaDecimalPointLocale): def test_fromstring_foreign_value(self): b = np.fromstring("1,234", dtype=np.longdouble, sep=" ") assert_array_equal(b[0], 1) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_machar.py b/numpy/core/tests/test_machar.py index 7acb02eef..ab8800c09 100644 --- a/numpy/core/tests/test_machar.py +++ b/numpy/core/tests/test_machar.py @@ -8,7 +8,7 @@ from __future__ import division, absolute_import, print_function from numpy.core.machar import MachAr import numpy.core.numerictypes as ntypes from numpy import errstate, array -from numpy.testing import run_module_suite + class TestMachAr(object): def _run_machar_highprec(self): @@ -30,7 +30,3 @@ class TestMachAr(object): except FloatingPointError as e: msg = "Caught %s exception, should not have been raised." % e raise AssertionError(msg) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_mem_overlap.py b/numpy/core/tests/test_mem_overlap.py index 076dc7c11..f4ce6a84a 100644 --- a/numpy/core/tests/test_mem_overlap.py +++ b/numpy/core/tests/test_mem_overlap.py @@ -10,8 +10,7 @@ from numpy.core import _umath_tests from numpy.lib.stride_tricks import as_strided from numpy.compat import long from numpy.testing import ( - run_module_suite, assert_, assert_raises, assert_equal, assert_array_equal, - assert_allclose + assert_, assert_raises, assert_equal, assert_array_equal, assert_allclose ) if sys.version_info[0] >= 3: @@ -949,7 +948,3 @@ class TestUFunc(object): x += x.T assert_array_equal(x - x.T, 0) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py index d6224ed02..6c88a9c2c 100644 --- a/numpy/core/tests/test_memmap.py +++ b/numpy/core/tests/test_memmap.py @@ -13,9 +13,8 @@ from numpy.compat import Path from numpy import arange, allclose, asarray from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - suppress_warnings -) + assert_, assert_equal, assert_array_equal, suppress_warnings + ) class TestMemmap(object): def setup(self): @@ -197,6 +196,3 @@ class TestMemmap(object): offset = mmap.ALLOCATIONGRANULARITY + 1 fp = memmap(self.tmpfp, shape=size, mode='w+', offset=offset) assert_(fp.offset == offset) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 31d7bd2d0..4bc85ad97 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -29,10 +29,10 @@ import numpy as np from numpy.compat import strchar, unicode import numpy.core._multiarray_tests as _multiarray_tests from numpy.testing import ( - run_module_suite, assert_, assert_raises, assert_warns, - assert_equal, assert_almost_equal, assert_array_equal, assert_raises_regex, - assert_array_almost_equal, assert_allclose, IS_PYPY, HAS_REFCOUNT, - assert_array_less, runstring, SkipTest, temppath, suppress_warnings + assert_, assert_raises, assert_warns, assert_equal, assert_almost_equal, + assert_array_equal, assert_raises_regex, assert_array_almost_equal, + assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring, + SkipTest, temppath, suppress_warnings ) from ._locales import CommaDecimalPointLocale @@ -7352,7 +7352,3 @@ def test_npymath_real(): got = fun(z) expected = npfun(z) assert_allclose(got, expected) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py index 50bcd4508..0e29876eb 100644 --- a/numpy/core/tests/test_nditer.py +++ b/numpy/core/tests/test_nditer.py @@ -8,8 +8,8 @@ import numpy as np import numpy.core._multiarray_tests as _multiarray_tests from numpy import array, arange, nditer, all from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_raises, assert_warns, HAS_REFCOUNT, suppress_warnings + assert_, assert_equal, assert_array_equal, assert_raises, assert_warns, + HAS_REFCOUNT, suppress_warnings ) @@ -2711,7 +2711,3 @@ def test_iter_too_large_with_multiindex(): # an axis with size 1 is removed: with assert_raises(ValueError): _multiarray_tests.test_nditer_too_large(arrays, i*2 + 1, mode) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 52eebdd02..40cccd404 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -11,10 +11,10 @@ import numpy as np from numpy.core import umath from numpy.random import rand, randint, randn from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_raises_regex, assert_array_equal, assert_almost_equal, - assert_array_almost_equal, suppress_warnings, HAS_REFCOUNT -) + assert_, assert_equal, assert_raises, assert_raises_regex, + assert_array_equal, assert_almost_equal, assert_array_almost_equal, + suppress_warnings, HAS_REFCOUNT + ) class TestResize(object): @@ -2734,7 +2734,3 @@ class TestTensordot(object): td = np.tensordot(a, b, (1, 0)) assert_array_equal(td, np.dot(a, b)) assert_array_equal(td, np.einsum('ij,jk', a, b)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_numerictypes.py b/numpy/core/tests/test_numerictypes.py index 8831cd1bb..cdf1b0490 100644 --- a/numpy/core/tests/test_numerictypes.py +++ b/numpy/core/tests/test_numerictypes.py @@ -4,9 +4,7 @@ import sys import itertools import numpy as np -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises -) +from numpy.testing import assert_, assert_equal, assert_raises # This is the structure of the table used for plain objects: # @@ -408,6 +406,3 @@ class TestIsSubDType(object): for w1, w2 in itertools.product(self.wrappers, repeat=2): assert_(not np.issubdtype(w1(np.float32), w2(np.float64))) assert_(not np.issubdtype(w1(np.float64), w2(np.float32))) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_print.py b/numpy/core/tests/test_print.py index b8b2581f3..746ad0e4b 100644 --- a/numpy/core/tests/test_print.py +++ b/numpy/core/tests/test_print.py @@ -3,9 +3,7 @@ from __future__ import division, absolute_import, print_function import sys import numpy as np -from numpy.testing import ( - run_module_suite, assert_, assert_equal, SkipTest - ) +from numpy.testing import assert_, assert_equal, SkipTest from ._locales import CommaDecimalPointLocale @@ -214,7 +212,3 @@ class TestCommaDecimalPointLocale(CommaDecimalPointLocale): def test_locale_longdouble(self): assert_equal(str(np.longdouble('1.2')), str(float(1.2))) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py index 8e261d226..9aeb93f74 100644 --- a/numpy/core/tests/test_records.py +++ b/numpy/core/tests/test_records.py @@ -14,8 +14,8 @@ from os import path import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_array_almost_equal, assert_raises, assert_warns + assert_, assert_equal, assert_array_equal, assert_array_almost_equal, + assert_raises, assert_warns ) @@ -414,6 +414,7 @@ class TestRecord(object): arr = np.zeros((3,), dtype=[('x', int), ('y', int)]) assert_raises(ValueError, lambda: arr[['nofield']]) + def test_find_duplicate(): l1 = [1, 2, 3, 4, 5, 6] assert_(np.rec.find_duplicate(l1) == []) @@ -426,6 +427,3 @@ def test_find_duplicate(): l3 = [2, 2, 1, 4, 1, 6, 2, 3] assert_(np.rec.find_duplicate(l3) == [2, 1]) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index ebc408b73..fe0adb8cb 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -14,10 +14,9 @@ from itertools import chain import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, IS_PYPY, - assert_almost_equal, assert_array_equal, assert_array_almost_equal, - assert_raises, assert_warns, suppress_warnings, - _assert_valid_refcount, HAS_REFCOUNT, + assert_, assert_equal, IS_PYPY, assert_almost_equal, + assert_array_equal, assert_array_almost_equal, assert_raises, + assert_warns, suppress_warnings, _assert_valid_refcount, HAS_REFCOUNT, ) from numpy.compat import asbytes, asunicode, long @@ -2333,6 +2332,3 @@ class TestRegression(object): #va[0] = b'\xff\xff\xff\xff' #del va #assert_equal(x, b'\x00\x00\x00\x00') - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_scalar_ctors.py b/numpy/core/tests/test_scalar_ctors.py index 3ae5e025f..b21bc9dad 100644 --- a/numpy/core/tests/test_scalar_ctors.py +++ b/numpy/core/tests/test_scalar_ctors.py @@ -9,8 +9,7 @@ import pytest import numpy as np from numpy.testing import ( - run_module_suite, assert_equal, assert_almost_equal, assert_raises, - assert_warns, + assert_equal, assert_almost_equal, assert_raises, assert_warns, ) class TestFromString(object): @@ -64,7 +63,3 @@ class TestFromInt(object): def test_uint64_from_negative(self): assert_equal(np.uint64(-2), np.uint64(18446744073709551614)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_scalarbuffer.py b/numpy/core/tests/test_scalarbuffer.py index 0f7aea9bc..6d57a5014 100644 --- a/numpy/core/tests/test_scalarbuffer.py +++ b/numpy/core/tests/test_scalarbuffer.py @@ -5,7 +5,7 @@ import sys import numpy as np import pytest -from numpy.testing import run_module_suite, assert_, assert_equal +from numpy.testing import assert_, assert_equal # PEP3118 format strings for native (standard alignment and byteorder) types scalars_and_codes = [ @@ -77,6 +77,3 @@ class TestScalarPEP3118(object): mv_a = memoryview(a) assert_equal(mv_x.itemsize, mv_a.itemsize) assert_equal(mv_x.format, mv_a.format) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_scalarinherit.py b/numpy/core/tests/test_scalarinherit.py index c5cd266eb..28436f6c7 100644 --- a/numpy/core/tests/test_scalarinherit.py +++ b/numpy/core/tests/test_scalarinherit.py @@ -5,7 +5,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ class A(object): @@ -72,7 +72,3 @@ class TestCharacter(object): res_np = np_s * np_i res_s = b'abc' * 5 assert_(res_np == res_s) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index 6d3ea02c5..ab2ef5ce6 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -9,11 +9,10 @@ import pytest import numpy as np from numpy.testing import ( - run_module_suite, - assert_, assert_equal, assert_raises, - assert_almost_equal, assert_allclose, assert_array_equal, - IS_PYPY, suppress_warnings, _gen_alignment_data, assert_warns -) + assert_, assert_equal, assert_raises, assert_almost_equal, assert_allclose, + assert_array_equal, IS_PYPY, suppress_warnings, _gen_alignment_data, + assert_warns + ) types = [np.bool_, np.byte, np.ubyte, np.short, np.ushort, np.intc, np.uintc, np.int_, np.uint, np.longlong, np.ulonglong, @@ -665,7 +664,3 @@ class TestAbs(object): def test_numpy_abs(self): self._test_abs_func(np.abs) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py index 47cd2a40a..94d8294f1 100644 --- a/numpy/core/tests/test_scalarprint.py +++ b/numpy/core/tests/test_scalarprint.py @@ -4,9 +4,9 @@ """ from __future__ import division, absolute_import, print_function +import tempfile import numpy as np -from numpy.testing import assert_, assert_equal, run_module_suite -import sys, tempfile +from numpy.testing import assert_, assert_equal class TestRealScalars(object): @@ -230,6 +230,3 @@ class TestRealScalars(object): # gh-2643, gh-6136, gh-6908 assert_equal(repr(np.float64(0.1)), repr(0.1)) assert_(repr(np.float64(0.20000000000000004)) != repr(0.2)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_shape_base.py b/numpy/core/tests/test_shape_base.py index deb2a407d..1d91a651e 100644 --- a/numpy/core/tests/test_shape_base.py +++ b/numpy/core/tests/test_shape_base.py @@ -2,11 +2,14 @@ from __future__ import division, absolute_import, print_function import warnings import numpy as np -from numpy.core import (array, arange, atleast_1d, atleast_2d, atleast_3d, - block, vstack, hstack, newaxis, concatenate, stack) -from numpy.testing import (assert_, assert_raises, - assert_array_equal, assert_equal, run_module_suite, - assert_raises_regex, assert_almost_equal) +from numpy.core import ( + array, arange, atleast_1d, atleast_2d, atleast_3d, block, vstack, hstack, + newaxis, concatenate, stack + ) +from numpy.testing import ( + assert_, assert_raises, assert_array_equal, assert_equal, + assert_raises_regex, assert_almost_equal + ) from numpy.compat import long @@ -581,7 +584,3 @@ class TestBlock(object): [3., 3., 3.]]]) assert_equal(result, expected) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py index 576ecaf0d..ea9ca021c 100644 --- a/numpy/core/tests/test_ufunc.py +++ b/numpy/core/tests/test_ufunc.py @@ -8,10 +8,10 @@ import numpy.core._umath_tests as umt import numpy.core._operand_flag_tests as opflag_tests import numpy.core._rational_tests as _rational_tests from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_array_equal, assert_almost_equal, assert_array_almost_equal, - assert_no_warnings, assert_allclose, -) + assert_, assert_equal, assert_raises, assert_array_equal, + assert_almost_equal, assert_array_almost_equal, assert_no_warnings, + assert_allclose, + ) class TestUfuncKwargs(object): @@ -1490,7 +1490,3 @@ class TestUfunc(object): def test_no_doc_string(self): # gh-9337 assert_('\n' not in umt.inner1d_no_doc.__doc__) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 9dc9f5f08..9da6abd4b 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -11,11 +11,11 @@ import numpy.core.umath as ncu from numpy.core import _umath_tests as ncu_tests import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, - assert_raises_regex, assert_array_equal, assert_almost_equal, - assert_array_almost_equal, assert_allclose, assert_no_warnings, - suppress_warnings, _gen_alignment_data, -) + assert_, assert_equal, assert_raises, assert_raises_regex, + assert_array_equal, assert_almost_equal, assert_array_almost_equal, + assert_allclose, assert_no_warnings, suppress_warnings, + _gen_alignment_data, + ) def on_powerpc(): @@ -2779,7 +2779,3 @@ def test_signaling_nan_exceptions(): with assert_no_warnings(): a = np.ndarray(shape=(), dtype='float32', buffer=b'\x00\xe0\xbf\xff') np.isnan(a) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_umath_complex.py b/numpy/core/tests/test_umath_complex.py index c5ab1b229..659a8a09e 100644 --- a/numpy/core/tests/test_umath_complex.py +++ b/numpy/core/tests/test_umath_complex.py @@ -7,9 +7,8 @@ import pytest import numpy as np import numpy.core.umath as ncu from numpy.testing import ( - run_module_suite, assert_raises, assert_equal, assert_array_equal, - assert_almost_equal -) + assert_raises, assert_equal, assert_array_equal, assert_almost_equal + ) # TODO: branch cuts (use Pauli code) # TODO: conj 'symmetry' @@ -536,6 +535,3 @@ def check_complex_value(f, x1, y1, x2, y2, exact=True): assert_equal(f(z1), z2) else: assert_almost_equal(f(z1), z2) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/core/tests/test_unicode.py b/numpy/core/tests/test_unicode.py index 8c502ca44..2ffd8801b 100644 --- a/numpy/core/tests/test_unicode.py +++ b/numpy/core/tests/test_unicode.py @@ -4,8 +4,7 @@ import sys import numpy as np from numpy.compat import unicode -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal) +from numpy.testing import assert_, assert_equal, assert_array_equal # Guess the UCS length for this python interpreter if sys.version_info[:2] >= (3, 3): @@ -395,7 +394,3 @@ class TestByteorder_1009_UCS4(ByteorderValues): """Check the byteorder in unicode (size 1009, UCS4 values)""" ulen = 1009 ucs_value = ucs4_value - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/distutils/tests/test_exec_command.py b/numpy/distutils/tests/test_exec_command.py index 5e7b3f3e8..8bd265007 100644 --- a/numpy/distutils/tests/test_exec_command.py +++ b/numpy/distutils/tests/test_exec_command.py @@ -6,7 +6,7 @@ from tempfile import TemporaryFile from numpy.distutils import exec_command from numpy.distutils.exec_command import get_pythonexe -from numpy.testing import run_module_suite, tempdir, assert_ +from numpy.testing import tempdir, assert_ # In python 3 stdout, stderr are text (unicode compliant) devices, so to # emulate them import StringIO from the io module. @@ -213,7 +213,3 @@ class TestExecCommand(object): self.check_nt(use_tee=1) self.check_execute_in(use_tee=0) self.check_execute_in(use_tee=1) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/distutils/tests/test_fcompiler_gnu.py b/numpy/distutils/tests/test_fcompiler_gnu.py index 659520513..49208aace 100644 --- a/numpy/distutils/tests/test_fcompiler_gnu.py +++ b/numpy/distutils/tests/test_fcompiler_gnu.py @@ -1,6 +1,6 @@ from __future__ import division, absolute_import, print_function -from numpy.testing import assert_, run_module_suite +from numpy.testing import assert_ import numpy.distutils.fcompiler @@ -55,7 +55,3 @@ class TestGFortranVersions(object): for vs, _ in g77_version_strings: v = fc.version_match(vs) assert_(v is None, (vs, v)) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/distutils/tests/test_fcompiler_intel.py b/numpy/distutils/tests/test_fcompiler_intel.py index b13a01788..5e014bada 100644 --- a/numpy/distutils/tests/test_fcompiler_intel.py +++ b/numpy/distutils/tests/test_fcompiler_intel.py @@ -1,7 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy.distutils.fcompiler -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ intel_32bit_version_strings = [ @@ -30,7 +30,3 @@ class TestIntelEM64TFCompilerVersions(object): for vs, version in intel_64bit_version_strings: v = fc.version_match(vs) assert_(v == version) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/distutils/tests/test_fcompiler_nagfor.py b/numpy/distutils/tests/test_fcompiler_nagfor.py index d45d3e3ce..1c936056a 100644 --- a/numpy/distutils/tests/test_fcompiler_nagfor.py +++ b/numpy/distutils/tests/test_fcompiler_nagfor.py @@ -1,7 +1,6 @@ from __future__ import division, absolute_import, print_function -from numpy.testing import assert_, run_module_suite - +from numpy.testing import assert_ import numpy.distutils.fcompiler nag_version_strings = [('nagfor', 'NAG Fortran Compiler Release ' @@ -23,7 +22,3 @@ class TestNagFCompilerVersions(object): fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp) v = fc.version_match(vs) assert_(v == version) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/distutils/tests/test_from_template.py b/numpy/distutils/tests/test_from_template.py index d3c513437..588175496 100644 --- a/numpy/distutils/tests/test_from_template.py +++ b/numpy/distutils/tests/test_from_template.py @@ -1,6 +1,6 @@ from numpy.distutils.from_template import process_str -from numpy.testing import assert_equal, run_module_suite +from numpy.testing import assert_equal pyf_src = """ @@ -42,7 +42,3 @@ def test_from_template(): normalized_pyf = normalize_whitespace(pyf) normalized_expected_pyf = normalize_whitespace(expected_pyf) assert_equal(normalized_pyf, normalized_expected_pyf) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/distutils/tests/test_misc_util.py b/numpy/distutils/tests/test_misc_util.py index dd4dbc842..2a3294ddf 100644 --- a/numpy/distutils/tests/test_misc_util.py +++ b/numpy/distutils/tests/test_misc_util.py @@ -4,10 +4,10 @@ from os.path import join, sep, dirname from numpy.distutils.misc_util import ( appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info -) + ) from numpy.testing import ( - run_module_suite, assert_, assert_equal -) + assert_, assert_equal + ) ajoin = lambda *paths: join(*((sep,)+paths)) @@ -79,7 +79,3 @@ def test_installed_npymath_ini(): # Regression test for gh-7707. If npymath.ini wasn't installed, then this # will give an error. info = get_info('npymath') - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/distutils/tests/test_npy_pkg_config.py b/numpy/distutils/tests/test_npy_pkg_config.py index 29891b63b..537e16e90 100644 --- a/numpy/distutils/tests/test_npy_pkg_config.py +++ b/numpy/distutils/tests/test_npy_pkg_config.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import os from numpy.distutils.npy_pkg_config import read_config, parse_flags -from numpy.testing import run_module_suite, temppath, assert_ +from numpy.testing import temppath, assert_ simple = """\ [meta] @@ -84,7 +84,3 @@ class TestParseFlags(object): d = parse_flags("-L /usr/lib -lfoo -L/usr/lib -lbar") assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib']) assert_(d['libraries'] == ['foo', 'bar']) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py index bec606c44..4aec13c82 100644 --- a/numpy/distutils/tests/test_system_info.py +++ b/numpy/distutils/tests/test_system_info.py @@ -8,9 +8,7 @@ from subprocess import Popen, PIPE from distutils.errors import DistutilsError from numpy.distutils import ccompiler, customized_ccompiler -from numpy.testing import ( - run_module_suite, assert_, assert_equal - ) +from numpy.testing import assert_, assert_equal from numpy.distutils.system_info import system_info, ConfigParser from numpy.distutils.system_info import default_lib_dirs, default_include_dirs @@ -235,7 +233,3 @@ class TestSystemInfoReading(object): assert_(os.path.isfile(self._src2.replace('.c', '.o'))) finally: os.chdir(previousDir) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/f2py/tests/test_array_from_pyobj.py b/numpy/f2py/tests/test_array_from_pyobj.py index cd6149c9a..8b021491f 100644 --- a/numpy/f2py/tests/test_array_from_pyobj.py +++ b/numpy/f2py/tests/test_array_from_pyobj.py @@ -7,10 +7,8 @@ import copy from numpy import ( array, alltrue, ndarray, zeros, dtype, intp, clongdouble -) -from numpy.testing import ( - run_module_suite, assert_, assert_equal, SkipTest -) + ) +from numpy.testing import assert_, assert_equal, SkipTest from numpy.core.multiarray import typeinfo from . import util @@ -584,7 +582,3 @@ class TestGen_%s(_test_shared_memory): self.type = Type(%r) array = lambda self,dims,intent,obj: Array(Type(%r),dims,intent,obj) ''' % (t, t, t)) - -if __name__ == "__main__": - setup_module() - run_module_suite() diff --git a/numpy/f2py/tests/test_assumed_shape.py b/numpy/f2py/tests/test_assumed_shape.py index b6fde20e4..460afd68d 100644 --- a/numpy/f2py/tests/test_assumed_shape.py +++ b/numpy/f2py/tests/test_assumed_shape.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import os import pytest -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ from . import util @@ -31,6 +31,3 @@ class TestAssumedShapeSumExample(util.F2PyTest): assert_(r == 3, repr(r)) r = self.module.mod.fsum([1, 2]) assert_(r == 3, repr(r)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_block_docstring.py b/numpy/f2py/tests/test_block_docstring.py index c820895c5..b2981aa82 100644 --- a/numpy/f2py/tests/test_block_docstring.py +++ b/numpy/f2py/tests/test_block_docstring.py @@ -5,7 +5,7 @@ import sys import pytest from . import util -from numpy.testing import run_module_suite, assert_equal +from numpy.testing import assert_equal class TestBlockDocString(util.F2PyTest): code = """ @@ -22,6 +22,3 @@ class TestBlockDocString(util.F2PyTest): def test_block_docstring(self): expected = "'i'-array(2,3)\n" assert_equal(self.module.block.__doc__, expected) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py index 19aa4dd6e..4e74947b0 100644 --- a/numpy/f2py/tests/test_callback.py +++ b/numpy/f2py/tests/test_callback.py @@ -6,7 +6,7 @@ import sys import pytest import numpy as np -from numpy.testing import run_module_suite, assert_, assert_equal +from numpy.testing import assert_, assert_equal from . import util @@ -163,7 +163,3 @@ cf2py intent(out) a f = getattr(self.module, 'string_callback_array') res = f(callback, cu, len(cu)) assert_(res == 0, repr(res)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_common.py b/numpy/f2py/tests/test_common.py index 30640f8e9..dcb01b0ec 100644 --- a/numpy/f2py/tests/test_common.py +++ b/numpy/f2py/tests/test_common.py @@ -7,7 +7,7 @@ import pytest import numpy as np from . import util -from numpy.testing import run_module_suite, assert_array_equal +from numpy.testing import assert_array_equal def _path(*a): return os.path.join(*((os.path.dirname(__file__),) + a)) @@ -25,6 +25,3 @@ class TestCommonBlock(util.F2PyTest): np.array('2', dtype='|S1')) assert_array_equal(self.module.block.ok, np.array(3, dtype=np.int32)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_kind.py b/numpy/f2py/tests/test_kind.py index 61c39a092..1f7762a80 100644 --- a/numpy/f2py/tests/test_kind.py +++ b/numpy/f2py/tests/test_kind.py @@ -3,11 +3,11 @@ from __future__ import division, absolute_import, print_function import os import pytest -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ from numpy.f2py.crackfortran import ( _selected_int_kind_func as selected_int_kind, _selected_real_kind_func as selected_real_kind -) + ) from . import util @@ -32,6 +32,3 @@ class TestKind(util.F2PyTest): assert_(selectedrealkind(i) in [selected_real_kind(i), -1], 'selectedrealkind(%s): expected %r but got %r' % (i, selected_real_kind(i), selectedrealkind(i))) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_mixed.py b/numpy/f2py/tests/test_mixed.py index e6eea8c4f..28268ecc0 100644 --- a/numpy/f2py/tests/test_mixed.py +++ b/numpy/f2py/tests/test_mixed.py @@ -4,7 +4,7 @@ import os import textwrap import pytest -from numpy.testing import run_module_suite, assert_, assert_equal +from numpy.testing import assert_, assert_equal from . import util @@ -36,6 +36,3 @@ class TestMixed(util.F2PyTest): """ assert_equal(self.module.bar11.__doc__, textwrap.dedent(expected).lstrip()) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_parameter.py b/numpy/f2py/tests/test_parameter.py index 11132475e..a0bbd9460 100644 --- a/numpy/f2py/tests/test_parameter.py +++ b/numpy/f2py/tests/test_parameter.py @@ -5,7 +5,7 @@ import math import pytest import numpy as np -from numpy.testing import run_module_suite, assert_raises, assert_equal +from numpy.testing import assert_raises, assert_equal from . import util @@ -117,7 +117,3 @@ class TestParameters(util.F2PyTest): x = np.arange(3, dtype=np.float64) self.module.foo_sum(x) assert_equal(x, [0 + 1*3*3 + 2*3*3, 1*3, 2*3]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_quoted_character.py b/numpy/f2py/tests/test_quoted_character.py index 748a17a38..09fc7328f 100644 --- a/numpy/f2py/tests/test_quoted_character.py +++ b/numpy/f2py/tests/test_quoted_character.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import sys import pytest -from numpy.testing import run_module_suite, assert_equal +from numpy.testing import assert_equal from . import util class TestQuotedCharacter(util.F2PyTest): @@ -28,6 +28,3 @@ Cf2py intent(out) OUT1, OUT2, OUT3, OUT4, OUT5, OUT6 reason='Fails with MinGW64 Gfortran (Issue #9673)') def test_quoted_character(self): assert_equal(self.module.foo(), (b"'", b'"', b';', b'!', b'(', b')')) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_regression.py b/numpy/f2py/tests/test_regression.py index a70d2c93f..d695de61b 100644 --- a/numpy/f2py/tests/test_regression.py +++ b/numpy/f2py/tests/test_regression.py @@ -5,7 +5,7 @@ import math import pytest import numpy as np -from numpy.testing import run_module_suite, assert_raises, assert_equal +from numpy.testing import assert_raises, assert_equal from . import util @@ -28,7 +28,3 @@ class TestIntentInOut(util.F2PyTest): x = np.arange(3, dtype=np.float32) self.module.foo(x) assert_equal(x, [3, 1, 2]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_return_character.py b/numpy/f2py/tests/test_return_character.py index ec2d02658..4a94c5b98 100644 --- a/numpy/f2py/tests/test_return_character.py +++ b/numpy/f2py/tests/test_return_character.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import pytest from numpy import array -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ from . import util @@ -144,6 +144,3 @@ end module f90_return_char def test_all(self): for name in "t0,t1,t5,ts,s0,s1,s5,ss".split(","): self.check_function(getattr(self.module.f90_return_char, name)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_return_complex.py b/numpy/f2py/tests/test_return_complex.py index 72c00afeb..152cfc960 100644 --- a/numpy/f2py/tests/test_return_complex.py +++ b/numpy/f2py/tests/test_return_complex.py @@ -4,7 +4,7 @@ import pytest from numpy import array from numpy.compat import long -from numpy.testing import run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises from . import util @@ -167,6 +167,3 @@ end module f90_return_complex def test_all(self): for name in "t0,t8,t16,td,s0,s8,s16,sd".split(","): self.check_function(getattr(self.module.f90_return_complex, name)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_return_integer.py b/numpy/f2py/tests/test_return_integer.py index befc515a2..7a4b07c4f 100644 --- a/numpy/f2py/tests/test_return_integer.py +++ b/numpy/f2py/tests/test_return_integer.py @@ -4,7 +4,7 @@ import pytest from numpy import array from numpy.compat import long -from numpy.testing import run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises from . import util @@ -177,6 +177,3 @@ end module f90_return_integer def test_all(self): for name in "t0,t1,t2,t4,t8,s0,s1,s2,s4,s8".split(","): self.check_function(getattr(self.module.f90_return_integer, name)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_return_logical.py b/numpy/f2py/tests/test_return_logical.py index 917cc3f60..403f4e205 100644 --- a/numpy/f2py/tests/test_return_logical.py +++ b/numpy/f2py/tests/test_return_logical.py @@ -4,7 +4,7 @@ import pytest from numpy import array from numpy.compat import long -from numpy.testing import run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises from . import util @@ -186,6 +186,3 @@ end module f90_return_logical def test_all(self): for name in "t0,t1,t2,t4,t8,s0,s1,s2,s4,s8".split(","): self.check_function(getattr(self.module.f90_return_logical, name)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_return_real.py b/numpy/f2py/tests/test_return_real.py index addbdcf49..fcb13e1e0 100644 --- a/numpy/f2py/tests/test_return_real.py +++ b/numpy/f2py/tests/test_return_real.py @@ -4,7 +4,7 @@ import pytest from numpy import array from numpy.compat import long -from numpy.testing import run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises from . import util @@ -202,7 +202,3 @@ end module f90_return_real def test_all(self): for name in "t0,t4,t8,td,s0,s4,s8,sd".split(","): self.check_function(getattr(self.module.f90_return_real, name)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_size.py b/numpy/f2py/tests/test_size.py index 59de9a64e..e2af61804 100644 --- a/numpy/f2py/tests/test_size.py +++ b/numpy/f2py/tests/test_size.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import os import pytest -from numpy.testing import run_module_suite, assert_equal +from numpy.testing import assert_equal from . import util @@ -49,6 +49,3 @@ class TestSizeSumExample(util.F2PyTest): r = self.module.flatten([[1, 2, 3], [4, 5, 6]]) assert_equal(r, [1, 2, 3, 4, 5, 6], repr(r)) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/f2py/tests/test_string.py b/numpy/f2py/tests/test_string.py index 79eeca1e9..0493c99cf 100644 --- a/numpy/f2py/tests/test_string.py +++ b/numpy/f2py/tests/test_string.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import os import pytest -from numpy.testing import run_module_suite, assert_array_equal +from numpy.testing import assert_array_equal import numpy as np from . import util @@ -22,6 +22,3 @@ class TestString(util.F2PyTest): expected = strings.copy() expected[1, :] = 'AAA' assert_array_equal(out, expected) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/fft/tests/test_fftpack.py b/numpy/fft/tests/test_fftpack.py index 7ac0488e4..8d6cd8407 100644 --- a/numpy/fft/tests/test_fftpack.py +++ b/numpy/fft/tests/test_fftpack.py @@ -3,8 +3,7 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.random import random from numpy.testing import ( - run_module_suite, assert_array_almost_equal, assert_array_equal, - assert_raises, + assert_array_almost_equal, assert_array_equal, assert_raises, ) import threading import sys @@ -184,7 +183,3 @@ class TestFFTThreadSafe(object): def test_irfft(self): a = np.ones(self.input_shape) * 1+0j self._test_mtsame(np.fft.irfft, a) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/fft/tests/test_helper.py b/numpy/fft/tests/test_helper.py index 4a19b8c60..8d315fa02 100644 --- a/numpy/fft/tests/test_helper.py +++ b/numpy/fft/tests/test_helper.py @@ -5,7 +5,7 @@ Copied from fftpack.helper by Pearu Peterson, October 2005 """ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import run_module_suite, assert_array_almost_equal, assert_equal +from numpy.testing import assert_array_almost_equal, assert_equal from numpy import fft, pi from numpy.fft.helper import _FFTCache @@ -246,7 +246,3 @@ class TestFFTCache(object): # Another big item - should now be the only item in the cache. c.put_twiddle_factors(6, np.ones(4000, dtype=np.float32)) assert_equal(list(c._dict.keys()), [6]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test__datasource.py b/numpy/lib/tests/test__datasource.py index a9cb157f3..32812990c 100644 --- a/numpy/lib/tests/test__datasource.py +++ b/numpy/lib/tests/test__datasource.py @@ -5,9 +5,7 @@ import sys from tempfile import mkdtemp, mkstemp, NamedTemporaryFile from shutil import rmtree -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises, SkipTest, - ) +from numpy.testing import assert_, assert_equal, assert_raises, SkipTest import numpy.lib._datasource as datasource if sys.version_info[0] >= 3: @@ -342,7 +340,3 @@ class TestOpenFunc(object): fp = datasource.open(local_file) assert_(fp) fp.close() - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test__iotools.py b/numpy/lib/tests/test__iotools.py index 54fac8da4..5f6c29a4d 100644 --- a/numpy/lib/tests/test__iotools.py +++ b/numpy/lib/tests/test__iotools.py @@ -6,7 +6,7 @@ from datetime import date import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_allclose, assert_raises, + assert_, assert_equal, assert_allclose, assert_raises, ) from numpy.lib._iotools import ( LineSplitter, NameValidator, StringConverter, @@ -346,6 +346,3 @@ class TestMiscFunctions(object): dt = np.dtype([(("a", "A"), "f8"), (("b", "B"), "f8")]) dt_flat = flatten_dtype(dt) assert_equal(dt_flat, [float, float]) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test__version.py b/numpy/lib/tests/test__version.py index 993c9d507..8e66a0c03 100644 --- a/numpy/lib/tests/test__version.py +++ b/numpy/lib/tests/test__version.py @@ -3,7 +3,7 @@ """ from __future__ import division, absolute_import, print_function -from numpy.testing import assert_, run_module_suite, assert_raises +from numpy.testing import assert_, assert_raises from numpy.lib import NumpyVersion @@ -64,7 +64,3 @@ def test_dev0_a_b_rc_mixed(): def test_raises(): for ver in ['1.9', '1,9.0', '1.7.x']: assert_raises(ValueError, NumpyVersion, ver) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index fce4c451d..8be49ce67 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -1090,7 +1090,3 @@ class TestTypeError1(object): kwargs = dict(mode='mean', stat_length=(3, )) assert_raises(TypeError, pad, arr, ((2, 3, 4), (3, 2)), **kwargs) - - -if __name__ == "__main__": - np.testing.run_module_suite() diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index 8286834a4..76c36c53e 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -6,9 +6,7 @@ from __future__ import division, absolute_import, print_function import numpy as np import sys -from numpy.testing import ( - run_module_suite, assert_array_equal, assert_equal, assert_raises, - ) +from numpy.testing import assert_array_equal, assert_equal, assert_raises from numpy.lib.arraysetops import ( ediff1d, intersect1d, setxor1d, union1d, setdiff1d, unique, in1d, isin ) @@ -504,7 +502,3 @@ class TestUnique(object): assert_array_equal(uniq[:, inv], data) msg = "Unique's return_counts=True failed with axis=1" assert_array_equal(cnt, np.array([2, 1, 1]), msg) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_arrayterator.py b/numpy/lib/tests/test_arrayterator.py index 64ad7f4de..2ce4456a5 100644 --- a/numpy/lib/tests/test_arrayterator.py +++ b/numpy/lib/tests/test_arrayterator.py @@ -46,7 +46,3 @@ def test(): # Check that all elements are iterated correctly assert_(list(c.flat) == list(d.flat)) - -if __name__ == '__main__': - from numpy.testing import run_module_suite - run_module_suite() diff --git a/numpy/lib/tests/test_financial.py b/numpy/lib/tests/test_financial.py index c5e92dbc0..524915041 100644 --- a/numpy/lib/tests/test_financial.py +++ b/numpy/lib/tests/test_financial.py @@ -4,9 +4,8 @@ from decimal import Decimal import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_almost_equal, assert_allclose, - assert_equal, assert_raises -) + assert_, assert_almost_equal, assert_allclose, assert_equal, assert_raises + ) class TestFinancial(object): @@ -339,7 +338,3 @@ class TestFinancial(object): Decimal('0'), [Decimal('0'), Decimal('0'), Decimal('1'), 'end', 'begin']), [Decimal('-74.998201'), Decimal('-75.62318601'), Decimal('-75.62318601'), Decimal('-76.88882405'), Decimal('-76.88882405')], 4) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 127f57605..38a9b8000 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -286,8 +286,7 @@ from io import BytesIO import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_array_equal, assert_raises, raises, - SkipTest + assert_, assert_array_equal, assert_raises, raises, SkipTest ) from numpy.lib import format @@ -853,7 +852,3 @@ def test_large_archive(): new_a = np.load(f)["arr"] assert_(a.shape == new_a.shape) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 2ea2dbc56..0a4c7c370 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -9,11 +9,11 @@ import pytest import numpy as np from numpy import ma from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_almost_equal, assert_array_almost_equal, assert_raises, - assert_allclose, assert_array_max_ulp, assert_warns, assert_raises_regex, - suppress_warnings, HAS_REFCOUNT, -) + assert_, assert_equal, assert_array_equal, assert_almost_equal, + assert_array_almost_equal, assert_raises, assert_allclose, + assert_array_max_ulp, assert_warns, assert_raises_regex, suppress_warnings, + HAS_REFCOUNT, + ) import numpy.lib.function_base as nfb from numpy.random import rand from numpy.lib import ( @@ -22,7 +22,7 @@ from numpy.lib import ( histogram, histogramdd, i0, insert, interp, kaiser, meshgrid, msort, piecewise, place, rot90, select, setxor1d, sinc, split, trapz, trim_zeros, unwrap, unique, vectorize -) + ) from numpy.compat import long @@ -2995,7 +2995,3 @@ class TestAdd_newdoc(object): assert_equal(np.core.flatiter.index.__doc__[:len(tgt)], tgt) assert_(len(np.core.ufunc.identity.__doc__) > 300) assert_(len(np.lib.index_tricks.mgrid.__doc__) > 300) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py index 6f73a8d60..6777089ab 100644 --- a/numpy/lib/tests/test_histograms.py +++ b/numpy/lib/tests/test_histograms.py @@ -4,11 +4,10 @@ import numpy as np from numpy.lib.histograms import histogram, histogramdd, histogram_bin_edges from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_almost_equal, assert_array_almost_equal, assert_raises, - assert_allclose, assert_array_max_ulp, assert_warns, assert_raises_regex, - suppress_warnings, -) + assert_, assert_equal, assert_array_equal, assert_almost_equal, + assert_array_almost_equal, assert_raises, assert_allclose, + assert_array_max_ulp, assert_warns, assert_raises_regex, suppress_warnings, + ) class TestHistogram(object): @@ -643,7 +642,3 @@ class TestHistogramdd(object): range=[[0.0, 1.0], [0.25, 0.75], [0.25, np.inf]]) assert_raises(ValueError, histogramdd, vals, range=[[0.0, 1.0], [np.nan, 0.75], [0.25, 0.5]]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index 0520ce580..a19f3f1be 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -2,9 +2,8 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_almost_equal, assert_array_almost_equal, assert_raises, - assert_raises_regex + assert_, assert_equal, assert_array_equal, assert_almost_equal, + assert_array_almost_equal, assert_raises, assert_raises_regex ) from numpy.lib.index_tricks import ( mgrid, ndenumerate, fill_diagonal, diag_indices, diag_indices_from, @@ -394,7 +393,3 @@ def test_ndindex(): # Make sure 0-sized ndindex works correctly x = list(ndindex(*[0])) assert_equal(x, []) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 0a032ce12..06c57d49c 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -21,9 +21,9 @@ from numpy.lib._iotools import ConverterError, ConversionWarning from numpy.compat import asbytes, bytes, unicode, Path from numpy.ma.testutils import assert_equal from numpy.testing import ( - run_module_suite, assert_warns, assert_, SkipTest, assert_raises_regex, - assert_raises, assert_allclose, assert_array_equal, temppath, tempdir, - IS_PYPY, HAS_REFCOUNT, suppress_warnings, + assert_warns, assert_, SkipTest, assert_raises_regex, assert_raises, + assert_allclose, assert_array_equal, temppath, tempdir, IS_PYPY, + HAS_REFCOUNT, suppress_warnings, ) @@ -2380,6 +2380,3 @@ def test_load_refcount(): finally: gc.enable() assert_equal(n_objects_in_cycles, 0) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_mixins.py b/numpy/lib/tests/test_mixins.py index 94f06c336..f2d915502 100644 --- a/numpy/lib/tests/test_mixins.py +++ b/numpy/lib/tests/test_mixins.py @@ -5,9 +5,7 @@ import operator import sys import numpy as np -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises - ) +from numpy.testing import assert_, assert_equal, assert_raises PY2 = sys.version_info.major < 3 @@ -213,7 +211,3 @@ class TestNDArrayOperatorsMixin(object): np.frexp(ArrayLike(2 ** -3)), expected) _assert_equal_type_and_value( np.frexp(ArrayLike(np.array(2 ** -3))), expected) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py index 3d362fc6e..1f403f7b8 100644 --- a/numpy/lib/tests/test_nanfunctions.py +++ b/numpy/lib/tests/test_nanfunctions.py @@ -4,8 +4,8 @@ import warnings import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_almost_equal, - assert_no_warnings, assert_raises, assert_array_equal, suppress_warnings + assert_, assert_equal, assert_almost_equal, assert_no_warnings, + assert_raises, assert_array_equal, suppress_warnings ) @@ -886,7 +886,3 @@ class TestNanFunctions_Percentile(object): megamat = np.ones((3, 4, 5, 6)) assert_equal(np.nanpercentile(megamat, perc, axis=(1, 2)).shape, (2, 3, 6)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_packbits.py b/numpy/lib/tests/test_packbits.py index 965cbf67c..fde5c37f2 100644 --- a/numpy/lib/tests/test_packbits.py +++ b/numpy/lib/tests/test_packbits.py @@ -1,9 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import ( - assert_array_equal, assert_equal, assert_raises, run_module_suite -) +from numpy.testing import assert_array_equal, assert_equal, assert_raises def test_packbits(): @@ -268,7 +266,3 @@ def test_unpackbits_large(): assert_array_equal(np.packbits(np.unpackbits(d, axis=1), axis=1), d) d = d.T.copy() assert_array_equal(np.packbits(np.unpackbits(d, axis=0), axis=0), d) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index 03915cead..1d7b8cbac 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -80,8 +80,8 @@ poly1d([ 2.]) ''' import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_almost_equal, assert_array_almost_equal, assert_raises, rundocs + assert_, assert_equal, assert_array_equal, assert_almost_equal, + assert_array_almost_equal, assert_raises, rundocs ) @@ -243,7 +243,3 @@ class TestDocs(object): p.coeffs[2] += 10 assert_equal(p.coeffs, [1, 2, 3]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index e1b62d46a..219ae24fa 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -6,9 +6,7 @@ import numpy as np import numpy.ma as ma from numpy.ma.mrecords import MaskedRecords from numpy.ma.testutils import assert_equal -from numpy.testing import ( - run_module_suite, assert_, assert_raises, - ) +from numpy.testing import assert_, assert_raises from numpy.lib.recfunctions import ( drop_fields, rename_fields, get_fieldstructure, recursive_fill_fields, find_duplicates, merge_arrays, append_fields, stack_arrays, join_by @@ -831,6 +829,3 @@ class TestAppendFieldsObj(object): control = np.array([(obj, 1.0, 10), (obj, 2.0, 20)], dtype=[('A', object), ('B', float), ('C', int)]) assert_equal(test, control) - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/lib/tests/test_regression.py b/numpy/lib/tests/test_regression.py index d96d3422d..4c46bc46b 100644 --- a/numpy/lib/tests/test_regression.py +++ b/numpy/lib/tests/test_regression.py @@ -5,8 +5,8 @@ import sys import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, - assert_array_almost_equal, assert_raises, _assert_valid_refcount, + assert_, assert_equal, assert_array_equal, assert_array_almost_equal, + assert_raises, _assert_valid_refcount, ) from numpy.compat import unicode @@ -252,7 +252,3 @@ class TestRegression(object): raise AssertionError() finally: out.close() - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index d0afeefd9..080fd066d 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -8,8 +8,7 @@ from numpy.lib.shape_base import ( vsplit, dstack, column_stack, kron, tile, expand_dims, ) from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, assert_raises, - assert_warns + assert_, assert_equal, assert_array_equal, assert_raises, assert_warns ) @@ -569,7 +568,3 @@ class TestMayShareMemory(object): def compare_results(res, desired): for i in range(len(desired)): assert_array_equal(res[i], desired[i]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_stride_tricks.py b/numpy/lib/tests/test_stride_tricks.py index 475119481..3c2ca8b87 100644 --- a/numpy/lib/tests/test_stride_tricks.py +++ b/numpy/lib/tests/test_stride_tricks.py @@ -3,12 +3,11 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.core._rational_tests import rational from numpy.testing import ( - run_module_suite, assert_equal, assert_array_equal, - assert_raises, assert_ + assert_equal, assert_array_equal, assert_raises, assert_ ) from numpy.lib.stride_tricks import ( as_strided, broadcast_arrays, _broadcast_shape, broadcast_to -) + ) def assert_shapes_correct(input_shapes, expected_shape): # Broadcast a list of arrays with the given input shapes and check the @@ -432,7 +431,3 @@ def test_reference_types(): actual, _ = broadcast_arrays(input_array, np.ones(3)) assert_array_equal(expected, actual) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py index 8183f7ca6..6e0fe0654 100644 --- a/numpy/lib/tests/test_twodim_base.py +++ b/numpy/lib/tests/test_twodim_base.py @@ -4,14 +4,14 @@ from __future__ import division, absolute_import, print_function from numpy.testing import ( - run_module_suite, assert_equal, assert_array_equal, assert_array_max_ulp, + assert_equal, assert_array_equal, assert_array_max_ulp, assert_array_almost_equal, assert_raises, ) from numpy import ( - arange, add, fliplr, flipud, zeros, ones, eye, array, diag, - histogram2d, tri, mask_indices, triu_indices, triu_indices_from, - tril_indices, tril_indices_from, vander, + arange, add, fliplr, flipud, zeros, ones, eye, array, diag, histogram2d, + tri, mask_indices, triu_indices, triu_indices_from, tril_indices, + tril_indices_from, vander, ) import numpy as np @@ -507,7 +507,3 @@ class TestVander(object): # so assert_array_equal *should* be safe here (rather than, say, # assert_array_almost_equal). yield (assert_array_equal, v, expected) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index ce8ef2f15..2982ca31a 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import numpy as np from numpy.compat import long from numpy.testing import ( - assert_, assert_equal, assert_array_equal, run_module_suite, assert_raises + assert_, assert_equal, assert_array_equal, assert_raises ) from numpy.lib.type_check import ( common_type, mintypecode, isreal, iscomplex, isposinf, isneginf, @@ -440,7 +440,3 @@ class TestArrayConversion(object): # other numpy function assert_raises(TypeError, asfarray, np.array([1, 2, 3]), dtype=np.array(1.0)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index 128ce37ab..ad006fe17 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -4,7 +4,7 @@ import numpy as np import numpy.core as nx import numpy.lib.ufunclike as ufl from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal, assert_warns + assert_, assert_equal, assert_array_equal, assert_warns ) @@ -91,6 +91,3 @@ class TestUfunclike(object): out = np.array(0.0) actual = np.fix(x, out=out) assert_(actual is out) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py index 7d8e7e68e..c27c3cbf5 100644 --- a/numpy/lib/tests/test_utils.py +++ b/numpy/lib/tests/test_utils.py @@ -4,9 +4,7 @@ import sys import pytest from numpy.core import arange -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises_regex - ) +from numpy.testing import assert_, assert_equal, assert_raises_regex from numpy.lib import deprecate import numpy.lib.utils as utils @@ -67,7 +65,3 @@ def test_byte_bounds(): def test_assert_raises_regex_context_manager(): with assert_raises_regex(ValueError, 'no deprecation warning'): raise ValueError('no deprecation warning') - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/linalg/tests/test_build.py b/numpy/linalg/tests/test_build.py index 2e9eb7389..921390da3 100644 --- a/numpy/linalg/tests/test_build.py +++ b/numpy/linalg/tests/test_build.py @@ -6,7 +6,7 @@ import re import pytest from numpy.linalg import lapack_lite -from numpy.testing import run_module_suite, assert_ +from numpy.testing import assert_ class FindDependenciesLdd(object): @@ -53,7 +53,3 @@ class TestF77Mismatch(object): """Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to cause random crashes and wrong results. See numpy INSTALL.txt for more information.""") - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/linalg/tests/test_deprecations.py b/numpy/linalg/tests/test_deprecations.py index 9b6fe343f..e12755e0d 100644 --- a/numpy/linalg/tests/test_deprecations.py +++ b/numpy/linalg/tests/test_deprecations.py @@ -4,7 +4,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import assert_warns, run_module_suite +from numpy.testing import assert_warns def test_qr_mode_full_future_warning(): @@ -20,7 +20,3 @@ def test_qr_mode_full_future_warning(): assert_warns(DeprecationWarning, np.linalg.qr, a, mode='f') assert_warns(DeprecationWarning, np.linalg.qr, a, mode='economic') assert_warns(DeprecationWarning, np.linalg.qr, a, mode='e') - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py index c0147ab64..4a87330c7 100644 --- a/numpy/linalg/tests/test_linalg.py +++ b/numpy/linalg/tests/test_linalg.py @@ -18,8 +18,7 @@ from numpy.linalg import matrix_power, norm, matrix_rank, multi_dot, LinAlgError from numpy.linalg.linalg import _multi_dot_matrix_chain_order from numpy.testing import ( assert_, assert_equal, assert_raises, assert_array_equal, - assert_almost_equal, assert_allclose, run_module_suite, - SkipTest, suppress_warnings + assert_almost_equal, assert_allclose, SkipTest, suppress_warnings ) @@ -1784,7 +1783,3 @@ class TestMultiDot(object): def test_too_few_input_arrays(self): assert_raises(ValueError, multi_dot, []) assert_raises(ValueError, multi_dot, [np.random.random((3, 3))]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/linalg/tests/test_regression.py b/numpy/linalg/tests/test_regression.py index c11689b3b..bd3a45872 100644 --- a/numpy/linalg/tests/test_regression.py +++ b/numpy/linalg/tests/test_regression.py @@ -7,7 +7,7 @@ import warnings import numpy as np from numpy import linalg, arange, float64, array, dot, transpose from numpy.testing import ( - run_module_suite, assert_, assert_raises, assert_equal, assert_array_equal, + assert_, assert_raises, assert_equal, assert_array_equal, assert_array_almost_equal, assert_array_less ) @@ -148,7 +148,3 @@ class TestRegression(object): u_lstsq, res, rank, sv = linalg.lstsq(G, b, rcond=None) # check results just in case assert_array_almost_equal(u_lstsq, u) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 69be64986..9caf38b56 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -24,7 +24,7 @@ import numpy.ma.core import numpy.core.fromnumeric as fromnumeric import numpy.core.umath as umath from numpy.testing import ( - run_module_suite, assert_raises, assert_warns, suppress_warnings + assert_raises, assert_warns, suppress_warnings ) from numpy import ndarray from numpy.compat import asbytes, asbytes_nested @@ -5119,8 +5119,3 @@ def test_astype(): x_f2 = np.array(x, dtype=x.dtype, order='F', subok=True) assert_(x_f2.flags.f_contiguous) assert_(x_f2.mask.flags.f_contiguous) - - -############################################################################### -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_deprecations.py b/numpy/ma/tests/test_deprecations.py index 23c095470..72cc29aa0 100644 --- a/numpy/ma/tests/test_deprecations.py +++ b/numpy/ma/tests/test_deprecations.py @@ -4,7 +4,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import run_module_suite, assert_warns +from numpy.testing import assert_warns from numpy.ma.testutils import assert_equal from numpy.ma.core import MaskedArrayFutureWarning @@ -68,7 +68,3 @@ class TestMinimumMaximum(object): result = ma_max(data1d) assert_equal(result, ma_max(data1d, axis=None)) assert_equal(result, ma_max(data1d, axis=0)) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index 95319eb65..a7a32b628 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -14,7 +14,7 @@ import itertools import numpy as np from numpy.testing import ( - run_module_suite, assert_warns, suppress_warnings, assert_raises, + assert_warns, suppress_warnings, assert_raises, ) from numpy.ma.testutils import ( assert_, assert_array_equal, assert_equal, assert_almost_equal @@ -1689,7 +1689,3 @@ class TestStack(object): assert_equal(c.shape, c_shp) assert_array_equal(a1.mask, c[..., 0].mask) assert_array_equal(a2.mask, c[..., 1].mask) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py index 1ca8e175f..e08dc1326 100644 --- a/numpy/ma/tests/test_mrecords.py +++ b/numpy/ma/tests/test_mrecords.py @@ -14,7 +14,7 @@ import numpy as np import numpy.ma as ma from numpy import recarray from numpy.ma import masked, nomask -from numpy.testing import run_module_suite, temppath +from numpy.testing import temppath from numpy.core.records import ( fromrecords as recfromrecords, fromarrays as recfromarrays ) @@ -494,7 +494,3 @@ def test_record_array_with_object_field(): dtype=[('a', int), ('b', object)]) # getting an item used to fail y[1] - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py index 9152e8d73..70eab0edc 100644 --- a/numpy/ma/tests/test_old_ma.py +++ b/numpy/ma/tests/test_old_ma.py @@ -6,7 +6,7 @@ import numpy as np import numpy.core.umath as umath import numpy.core.fromnumeric as fromnumeric from numpy.testing import ( - run_module_suite, assert_, assert_raises, assert_equal, + assert_, assert_raises, assert_equal, ) from numpy.ma.testutils import assert_array_equal from numpy.ma import ( @@ -854,6 +854,3 @@ def eqmask(m1, m2): if m2 is nomask: return m1 is nomask return (m1 == m2).all() - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_regression.py b/numpy/ma/tests/test_regression.py index 925b21a14..04e10d9d1 100644 --- a/numpy/ma/tests/test_regression.py +++ b/numpy/ma/tests/test_regression.py @@ -4,8 +4,7 @@ import warnings import numpy as np from numpy.testing import ( - assert_, assert_array_equal, assert_allclose, run_module_suite, - suppress_warnings + assert_, assert_array_equal, assert_allclose, suppress_warnings ) @@ -75,6 +74,3 @@ class TestRegression(object): r1 = np.ma.corrcoef(x, y, ddof=1) # ddof should not have an effect (it gets cancelled out) assert_allclose(r0.data, r1.data) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/ma/tests/test_subclassing.py b/numpy/ma/tests/test_subclassing.py index dec8a9cef..b61a46278 100644 --- a/numpy/ma/tests/test_subclassing.py +++ b/numpy/ma/tests/test_subclassing.py @@ -9,7 +9,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises from numpy.ma.testutils import assert_equal from numpy.ma.core import ( array, arange, masked, MaskedArray, masked_array, log, add, hypot, @@ -370,8 +370,3 @@ class TestSubclassing(object): diff2 = arr1 - arr2 assert_('info' in diff2._optinfo) assert_(diff2._optinfo['info'] == 'test') - - -############################################################################### -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index c4ee639ed..c0deaa9f4 100644 --- a/numpy/ma/testutils.py +++ b/numpy/ma/testutils.py @@ -15,7 +15,7 @@ import numpy.core.umath as umath import numpy.testing from numpy.testing import ( assert_, assert_allclose, assert_array_almost_equal_nulp, - assert_raises, build_err_msg, run_module_suite + assert_raises, build_err_msg ) from .core import mask_or, getmask, masked_array, nomask, masked, filled @@ -33,8 +33,8 @@ __all__masked = [ # masked arrays. But there was no way to tell before. from unittest import TestCase __some__from_testing = [ - 'TestCase', 'assert_', 'assert_allclose', - 'assert_array_almost_equal_nulp', 'assert_raises', 'run_module_suite', + 'TestCase', 'assert_', 'assert_allclose', 'assert_array_almost_equal_nulp', + 'assert_raises' ] __all__ = __all__masked + __some__from_testing diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index d5435a1a3..a02a05c09 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -10,9 +10,9 @@ except ImportError: import numpy as np from numpy import matrix, asmatrix, bmat from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_almost_equal, - assert_array_equal, assert_array_almost_equal, assert_raises -) + assert_, assert_equal, assert_almost_equal, assert_array_equal, + assert_array_almost_equal, assert_raises + ) from numpy.matrixlib.defmatrix import matrix_power from numpy.matrixlib import mat @@ -458,7 +458,3 @@ class TestShape(object): def test_matrix_memory_sharing(self): assert_(np.may_share_memory(self.m, self.m.ravel())) assert_(not np.may_share_memory(self.m, self.m.flatten())) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/matrixlib/tests/test_multiarray.py b/numpy/matrixlib/tests/test_multiarray.py index bf891a196..6d84bd477 100644 --- a/numpy/matrixlib/tests/test_multiarray.py +++ b/numpy/matrixlib/tests/test_multiarray.py @@ -1,9 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_array_equal -) +from numpy.testing import assert_, assert_equal, assert_array_equal class TestView(object): def test_type(self): @@ -18,6 +16,3 @@ class TestView(object): assert_(isinstance(y, np.matrix)) assert_equal(y.dtype, np.dtype('<i2')) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/matrixlib/tests/test_numeric.py b/numpy/matrixlib/tests/test_numeric.py index b826b8e81..95e1c8001 100644 --- a/numpy/matrixlib/tests/test_numeric.py +++ b/numpy/matrixlib/tests/test_numeric.py @@ -1,7 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import assert_equal, run_module_suite +from numpy.testing import assert_equal class TestDot(object): def test_matscalar(self): @@ -17,7 +17,3 @@ def test_diagonal(): assert_equal(b1.diagonal(), diag_b1) assert_equal(np.diagonal(b1), array_b1) assert_equal(np.diag(b1), array_b1) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/matrixlib/tests/test_regression.py b/numpy/matrixlib/tests/test_regression.py index 32cb38ac7..70e147279 100644 --- a/numpy/matrixlib/tests/test_regression.py +++ b/numpy/matrixlib/tests/test_regression.py @@ -1,9 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.testing import ( - run_module_suite, assert_, assert_equal, assert_raises - ) +from numpy.testing import assert_, assert_equal, assert_raises class TestRegression(object): @@ -33,6 +31,3 @@ class TestRegression(object): x = np.asmatrix(np.random.uniform(0, 1, (3, 3))) assert_equal(x.std().shape, ()) assert_equal(x.argmax().shape, ()) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_chebyshev.py b/numpy/polynomial/tests/test_chebyshev.py index f003081cb..439dfa08d 100644 --- a/numpy/polynomial/tests/test_chebyshev.py +++ b/numpy/polynomial/tests/test_chebyshev.py @@ -8,7 +8,6 @@ import numpy.polynomial.chebyshev as cheb from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) @@ -609,6 +608,3 @@ class TestMisc(object): assert_almost_equal(cheb.chebpts2(4), tgt) tgt = [-1.0, -0.707106781187, 0, 0.707106781187, 1.0] assert_almost_equal(cheb.chebpts2(5), tgt) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py index 896137c9a..262de5fe2 100644 --- a/numpy/polynomial/tests/test_classes.py +++ b/numpy/polynomial/tests/test_classes.py @@ -13,7 +13,7 @@ from numpy.polynomial import ( Polynomial, Legendre, Chebyshev, Laguerre, Hermite, HermiteE) from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite) + ) from numpy.compat import long @@ -606,7 +606,3 @@ class TestInterpolate(object): for t in range(0, deg + 1): p = Chebyshev.interpolate(powx, deg, domain=[0, 2], args=(t,)) assert_almost_equal(p(x), powx(x, t), decimal=12) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_hermite.py b/numpy/polynomial/tests/test_hermite.py index 08b0a883a..18c26af8f 100644 --- a/numpy/polynomial/tests/test_hermite.py +++ b/numpy/polynomial/tests/test_hermite.py @@ -8,7 +8,6 @@ import numpy.polynomial.hermite as herm from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) H0 = np.array([1]) @@ -545,7 +544,3 @@ class TestMisc(object): tgt = np.exp(-x**2) res = herm.hermweight(x) assert_almost_equal(res, tgt) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_hermite_e.py b/numpy/polynomial/tests/test_hermite_e.py index ab05a2a21..58d74dae9 100644 --- a/numpy/polynomial/tests/test_hermite_e.py +++ b/numpy/polynomial/tests/test_hermite_e.py @@ -8,7 +8,6 @@ import numpy.polynomial.hermite_e as herme from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) He0 = np.array([1]) @@ -546,7 +545,3 @@ class TestMisc(object): tgt = np.exp(-.5*x**2) res = herme.hermeweight(x) assert_almost_equal(res, tgt) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_laguerre.py b/numpy/polynomial/tests/test_laguerre.py index c6b01ff7e..3cb630e46 100644 --- a/numpy/polynomial/tests/test_laguerre.py +++ b/numpy/polynomial/tests/test_laguerre.py @@ -8,7 +8,6 @@ import numpy.polynomial.laguerre as lag from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) L0 = np.array([1])/1 @@ -527,7 +526,3 @@ class TestMisc(object): tgt = np.exp(-x) res = lag.lagweight(x) assert_almost_equal(res, tgt) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_legendre.py b/numpy/polynomial/tests/test_legendre.py index 8547c9039..aeecd8775 100644 --- a/numpy/polynomial/tests/test_legendre.py +++ b/numpy/polynomial/tests/test_legendre.py @@ -8,7 +8,6 @@ import numpy.polynomial.legendre as leg from numpy.polynomial.polynomial import polyval from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) L0 = np.array([1]) @@ -546,7 +545,3 @@ class TestMisc(object): tgt = 1. res = leg.legweight(x) assert_almost_equal(res, tgt) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_polynomial.py b/numpy/polynomial/tests/test_polynomial.py index 370fbd616..67728e35e 100644 --- a/numpy/polynomial/tests/test_polynomial.py +++ b/numpy/polynomial/tests/test_polynomial.py @@ -7,7 +7,6 @@ import numpy as np import numpy.polynomial.polynomial as poly from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) @@ -566,7 +565,3 @@ class TestMisc(object): def test_polyline(self): assert_equal(poly.polyline(3, 4), [3, 4]) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_polyutils.py b/numpy/polynomial/tests/test_polyutils.py index bd1cb2008..32ea55716 100644 --- a/numpy/polynomial/tests/test_polyutils.py +++ b/numpy/polynomial/tests/test_polyutils.py @@ -7,7 +7,6 @@ import numpy as np import numpy.polynomial.polyutils as pu from numpy.testing import ( assert_almost_equal, assert_raises, assert_equal, assert_, - run_module_suite ) @@ -104,7 +103,3 @@ class TestDomain(object): tgt = [-1 + 1j, 1 - 1j] res = pu.mapparms(dom1, dom2) assert_almost_equal(res, tgt) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/polynomial/tests/test_printing.py b/numpy/polynomial/tests/test_printing.py index 939d48a86..3f1236402 100644 --- a/numpy/polynomial/tests/test_printing.py +++ b/numpy/polynomial/tests/test_printing.py @@ -1,7 +1,7 @@ from __future__ import division, absolute_import, print_function import numpy.polynomial as poly -from numpy.testing import run_module_suite, assert_equal +from numpy.testing import assert_equal class TestStr(object): @@ -66,9 +66,3 @@ class TestRepr(object): res = repr(poly.Laguerre([0, 1])) tgt = 'Laguerre([0., 1.], domain=[0, 1], window=[0, 1])' assert_equal(res, tgt) - - -# - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 4546a0184..61c6e912d 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -3,7 +3,7 @@ import warnings import numpy as np from numpy.testing import ( - run_module_suite, assert_, assert_raises, assert_equal, assert_warns, + assert_, assert_raises, assert_equal, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings ) @@ -1634,6 +1634,3 @@ class TestSingleEltArrayInput(object): out = func(self.argOne, self.argTwo[0], self.argThree) assert_equal(out.shape, self.tgtShape) - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/random/tests/test_regression.py b/numpy/random/tests/test_regression.py index 572f4c087..3b4b4ed40 100644 --- a/numpy/random/tests/test_regression.py +++ b/numpy/random/tests/test_regression.py @@ -2,7 +2,7 @@ from __future__ import division, absolute_import, print_function import sys from numpy.testing import ( - run_module_suite, assert_, assert_array_equal, assert_raises, + assert_, assert_array_equal, assert_raises, ) from numpy import random from numpy.compat import long @@ -133,6 +133,3 @@ class TestRegression(object): # Force Garbage Collection - should not segfault. import gc gc.collect() - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/testing/tests/test_decorators.py b/numpy/testing/tests/test_decorators.py index 26be1e359..ea684140d 100644 --- a/numpy/testing/tests/test_decorators.py +++ b/numpy/testing/tests/test_decorators.py @@ -8,8 +8,7 @@ import warnings import pytest from numpy.testing import ( - assert_, assert_raises, run_module_suite, dec, SkipTest, - KnownFailureException, + assert_, assert_raises, dec, SkipTest, KnownFailureException, ) @@ -215,7 +214,3 @@ class TestNoseDecorators(object): test[0](*test[1:]) count += 1 assert_(count == 3) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 4ba484ba0..35f81d8a7 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -10,12 +10,11 @@ import pytest import numpy as np from numpy.testing import ( assert_equal, assert_array_equal, assert_almost_equal, - assert_array_almost_equal, assert_array_less, build_err_msg, - raises, assert_raises, assert_warns, assert_no_warnings, - assert_allclose, assert_approx_equal, - assert_array_almost_equal_nulp, assert_array_max_ulp, - clear_and_catch_warnings, suppress_warnings, run_module_suite, - assert_string_equal, assert_, tempdir, temppath, + assert_array_almost_equal, assert_array_less, build_err_msg, raises, + assert_raises, assert_warns, assert_no_warnings, assert_allclose, + assert_approx_equal, assert_array_almost_equal_nulp, assert_array_max_ulp, + clear_and_catch_warnings, suppress_warnings, assert_string_equal, assert_, + tempdir, temppath, ) @@ -1361,7 +1360,3 @@ def test_clear_and_catch_warnings_inherit(): warnings.simplefilter('ignore') warnings.warn('Some warning') assert_equal(my_mod.__warningregistry__, {}) - - -if __name__ == '__main__': - run_module_suite() diff --git a/numpy/tests/test_ctypeslib.py b/numpy/tests/test_ctypeslib.py index a208c9073..0f0d6dbc4 100644 --- a/numpy/tests/test_ctypeslib.py +++ b/numpy/tests/test_ctypeslib.py @@ -6,7 +6,7 @@ import pytest 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 run_module_suite, assert_, assert_raises +from numpy.testing import assert_, assert_raises try: cdll = None @@ -113,7 +113,3 @@ class TestNdpointer(object): a1 = ndpointer(dtype=np.float64) a2 = ndpointer(dtype=np.float64) assert_(a1 == a2) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/tests/test_matlib.py b/numpy/tests/test_matlib.py index d16975934..12116b883 100644 --- a/numpy/tests/test_matlib.py +++ b/numpy/tests/test_matlib.py @@ -2,7 +2,7 @@ from __future__ import division, absolute_import, print_function import numpy as np import numpy.matlib -from numpy.testing import assert_array_equal, assert_, run_module_suite +from numpy.testing import assert_array_equal, assert_ def test_empty(): x = numpy.matlib.empty((2,)) @@ -58,7 +58,3 @@ def test_repmat(): y = np.array([[0, 1, 2, 3, 0, 1, 2, 3], [0, 1, 2, 3, 0, 1, 2, 3]]) assert_array_equal(x, y) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/tests/test_numpy_version.py b/numpy/tests/test_numpy_version.py index b61d0d5f1..7fac8fd22 100644 --- a/numpy/tests/test_numpy_version.py +++ b/numpy/tests/test_numpy_version.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import re import numpy as np -from numpy.testing import assert_, run_module_suite +from numpy.testing import assert_ def test_valid_numpy_version(): @@ -17,7 +17,3 @@ def test_valid_numpy_version(): res = re.match(version_pattern + dev_suffix, np.__version__) assert_(res is not None, np.__version__) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/tests/test_reloading.py b/numpy/tests/test_reloading.py index 4481d76ef..cd42252e3 100644 --- a/numpy/tests/test_reloading.py +++ b/numpy/tests/test_reloading.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import sys import pickle -from numpy.testing import assert_raises, assert_, assert_equal, run_module_suite +from numpy.testing import assert_raises, assert_, assert_equal if sys.version_info[:2] >= (3, 4): from importlib import reload @@ -34,7 +34,3 @@ def test_novalue(): import numpy as np assert_equal(repr(np._NoValue), '<no value>') assert_(pickle.loads(pickle.dumps(np._NoValue)) is np._NoValue) - - -if __name__ == "__main__": - run_module_suite() diff --git a/numpy/tests/test_warnings.py b/numpy/tests/test_warnings.py index abebdafc8..aa6f69f7e 100644 --- a/numpy/tests/test_warnings.py +++ b/numpy/tests/test_warnings.py @@ -12,7 +12,6 @@ if sys.version_info >= (3, 4): import ast import tokenize import numpy - from numpy.testing import run_module_suite class ParseCall(ast.NodeVisitor): def __init__(self): @@ -77,7 +76,3 @@ if sys.version_info >= (3, 4): with tokenize.open(str(path)) as file: tree = ast.parse(file.read()) FindFuncs(path).visit(tree) - - - if __name__ == "__main__": - run_module_suite() |