summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-01-05 00:53:30 -0500
committerWarren Weckesser <warren.weckesser@gmail.com>2020-01-05 00:53:30 -0500
commitc31cc36a8a814ed4844a2a553454185601914a5a (patch)
treeadb28a762dc0985eed669db75b564b3f5c3bfbcc /numpy/testing
parentc1f1bc9ce8e4e2936e80d9bfafc3d8e03237a84b (diff)
downloadnumpy-c31cc36a8a814ed4844a2a553454185601914a5a.tar.gz
MAINT: Remove implicit inheritance from object class (#15236)
Inheriting from object was necessary for Python 2 compatibility to use new-style classes. In Python 3, this is unnecessary as there are no old-style classes. Dropping the object is more idiomatic Python.
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/_private/noseclasses.py2
-rw-r--r--numpy/testing/_private/nosetester.py2
-rw-r--r--numpy/testing/_private/parameterized.py4
-rw-r--r--numpy/testing/_private/utils.py2
-rwxr-xr-xnumpy/testing/print_coercion_tables.py2
-rw-r--r--numpy/testing/tests/test_decorators.py2
-rw-r--r--numpy/testing/tests/test_utils.py28
7 files changed, 21 insertions, 21 deletions
diff --git a/numpy/testing/_private/noseclasses.py b/numpy/testing/_private/noseclasses.py
index 7cad24620..493bacfdd 100644
--- a/numpy/testing/_private/noseclasses.py
+++ b/numpy/testing/_private/noseclasses.py
@@ -266,7 +266,7 @@ class NumpyDoctest(npd.Doctest):
return npd.Doctest.wantFile(self, file)
-class Unplugger(object):
+class Unplugger:
""" Nose plugin to remove named plugin late in loading
By default it removes the "doctest" plugin.
diff --git a/numpy/testing/_private/nosetester.py b/numpy/testing/_private/nosetester.py
index 6226eeb3c..a874321cc 100644
--- a/numpy/testing/_private/nosetester.py
+++ b/numpy/testing/_private/nosetester.py
@@ -110,7 +110,7 @@ def run_module_suite(file_to_run=None, argv=None):
nose.run(argv=argv, addplugins=[KnownFailurePlugin()])
-class NoseTester(object):
+class NoseTester:
"""
Nose test runner.
diff --git a/numpy/testing/_private/parameterized.py b/numpy/testing/_private/parameterized.py
index 2134cca88..dbfb4807c 100644
--- a/numpy/testing/_private/parameterized.py
+++ b/numpy/testing/_private/parameterized.py
@@ -293,10 +293,10 @@ def detect_runner():
_test_runner_guess = None
return _test_runner_guess
-class parameterized(object):
+class parameterized:
""" Parameterize a test case::
- class TestInt(object):
+ class TestInt:
@parameterized([
("A", 10),
("F", 15),
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index 1e118b538..9e5a2eb2a 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -2001,7 +2001,7 @@ class clear_and_catch_warnings(warnings.catch_warnings):
mod.__warningregistry__.update(self._warnreg_copies[mod])
-class suppress_warnings(object):
+class suppress_warnings:
"""
Context manager and decorator doing much the same as
``warnings.catch_warnings``.
diff --git a/numpy/testing/print_coercion_tables.py b/numpy/testing/print_coercion_tables.py
index c11b31968..84d46b59b 100755
--- a/numpy/testing/print_coercion_tables.py
+++ b/numpy/testing/print_coercion_tables.py
@@ -5,7 +5,7 @@
import numpy as np
# Generic object that can be added, but doesn't do anything else
-class GenericObject(object):
+class GenericObject:
def __init__(self, v):
self.v = v
diff --git a/numpy/testing/tests/test_decorators.py b/numpy/testing/tests/test_decorators.py
index fc8d764c2..77f8b66ba 100644
--- a/numpy/testing/tests/test_decorators.py
+++ b/numpy/testing/tests/test_decorators.py
@@ -21,7 +21,7 @@ else:
@pytest.mark.skipif(not HAVE_NOSE, reason="Needs nose")
-class TestNoseDecorators(object):
+class TestNoseDecorators:
# These tests are run in a class for simplicity while still
# getting a report on each, skipped or success.
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index f752c63f3..232ca0e83 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -18,7 +18,7 @@ from numpy.testing import (
from numpy.core.overrides import ARRAY_FUNCTION_ENABLED
-class _GenericTest(object):
+class _GenericTest:
def _test_equal(self, a, b):
self._assert_func(a, b)
@@ -209,7 +209,7 @@ class TestArrayEqual(_GenericTest):
self._test_not_equal(b, a)
-class TestBuildErrorMessage(object):
+class TestBuildErrorMessage:
def test_build_err_msg_defaults(self):
x = np.array([1.00001, 2.00002, 3.00003])
@@ -616,7 +616,7 @@ class TestAlmostEqual(_GenericTest):
self._assert_func(a, a)
-class TestApproxEqual(object):
+class TestApproxEqual:
def setup(self):
self._assert_func = assert_approx_equal
@@ -659,7 +659,7 @@ class TestApproxEqual(object):
assert_raises(AssertionError, lambda: self._assert_func(ainf, anan))
-class TestArrayAssertLess(object):
+class TestArrayAssertLess:
def setup(self):
self._assert_func = assert_array_less
@@ -769,7 +769,7 @@ class TestArrayAssertLess(object):
@pytest.mark.skip(reason="The raises decorator depends on Nose")
-class TestRaises(object):
+class TestRaises:
def setup(self):
class MyException(Exception):
@@ -803,7 +803,7 @@ class TestRaises(object):
raise AssertionError("should have raised an AssertionError")
-class TestWarns(object):
+class TestWarns:
def test_warn(self):
def f():
@@ -854,7 +854,7 @@ class TestWarns(object):
raise AssertionError("wrong warning caught by assert_warn")
-class TestAssertAllclose(object):
+class TestAssertAllclose:
def test_simple(self):
x = 1e-3
@@ -924,7 +924,7 @@ class TestAssertAllclose(object):
assert_('Max relative difference: 0.5' in msg)
-class TestArrayAlmostEqualNulp(object):
+class TestArrayAlmostEqualNulp:
def test_float64_pass(self):
# The number of units of least precision
@@ -1121,7 +1121,7 @@ class TestArrayAlmostEqualNulp(object):
xi, y + y*1j, nulp)
-class TestULP(object):
+class TestULP:
def test_equal(self):
x = np.random.randn(10)
@@ -1177,7 +1177,7 @@ class TestULP(object):
maxulp=maxulp))
-class TestStringEqual(object):
+class TestStringEqual:
def test_simple(self):
assert_string_equal("hello", "hello")
assert_string_equal("hello\nmultiline", "hello\nmultiline")
@@ -1239,7 +1239,7 @@ def test_warn_len_equal_call_scenarios():
# check that no assertion is uncaught
# parallel scenario -- no warning issued yet
- class mod(object):
+ class mod:
pass
mod_inst = mod()
@@ -1249,7 +1249,7 @@ def test_warn_len_equal_call_scenarios():
# serial test scenario -- the __warningregistry__
# attribute should be present
- class mod(object):
+ class mod:
def __init__(self):
self.__warningregistry__ = {'warning1':1,
'warning2':2}
@@ -1524,7 +1524,7 @@ def test_clear_and_catch_warnings_inherit():
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
-class TestAssertNoGcCycles(object):
+class TestAssertNoGcCycles:
""" Test assert_no_gc_cycles """
def test_passes(self):
def no_cycle():
@@ -1558,7 +1558,7 @@ class TestAssertNoGcCycles(object):
error, instead of hanging forever trying to clear it.
"""
- class ReferenceCycleInDel(object):
+ class ReferenceCycleInDel:
"""
An object that not only contains a reference cycle, but creates new
cycles whenever it's garbage-collected and its __del__ runs