From 4e3d82f234fd784c784678e03c489c426021d1af Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Thu, 16 Feb 2023 14:54:45 -0500 Subject: [PATCH] No more explicit object inheritance --- tests/_util.py | 2 +- tests/collection.py | 4 ++-- tests/config.py | 4 ++-- tests/context.py | 2 +- tests/util.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/_util.py b/tests/_util.py index 4d6fef16..3687666c 100644 --- a/tests/_util.py +++ b/tests/_util.py @@ -107,7 +107,7 @@ def expect( return stdout, stderr -class MockSubprocess(object): +class MockSubprocess: def __init__(self, out="", err="", exit=0, isatty=None, autostart=True): self.out_file = BytesIO(out.encode()) self.err_file = BytesIO(err.encode()) diff --git a/tests/collection.py b/tests/collection.py index cd0f1950..f613f346 100644 --- a/tests/collection.py +++ b/tests/collection.py @@ -301,7 +301,7 @@ def prefers_task_name_attr_over_function_name(self): def raises_ValueError_if_no_name_found(self): # Can't use a lambda here as they are technically real functions. - class Callable(object): + class Callable: def __call__(self, ctx): pass @@ -560,7 +560,7 @@ def transforms_are_applied_to_explicit_module_namespaces(self): # from_module() with explicit 'ns' objects!) namespace = self._nested_underscores() - class FakeModule(object): + class FakeModule: __name__ = "my_module" ns = namespace diff --git a/tests/config.py b/tests/config.py index a7bd5e36..34a070c0 100644 --- a/tests/config.py +++ b/tests/config.py @@ -775,7 +775,7 @@ def numeric_types_become_casted(self): def arbitrary_types_work_too(self): os.environ["INVOKE_FOO"] = "whatever" - class Meh(object): + class Meh: def __init__(self, thing=None): pass @@ -1047,7 +1047,7 @@ def raises_TypeError_if_value_is_not_Config_subclass(self): else: assert False, "Non-class obj did not raise TypeError!" - class Foo(object): + class Foo: pass try: diff --git a/tests/context.py b/tests/context.py index 0b415e68..b7266042 100644 --- a/tests/context.py +++ b/tests/context.py @@ -209,7 +209,7 @@ class Oops(Exception): @patch(local_path) def cd_should_accept_any_stringable_object(self, Local): - class Path(object): + class Path: def __init__(self, value): self.value = value diff --git a/tests/util.py b/tests/util.py index d1bffe7e..b01a8aa4 100644 --- a/tests/util.py +++ b/tests/util.py @@ -46,7 +46,7 @@ def foo(c): def is_None_if_docstring_matches_object_type(self): # I.e. we don't want a docstring that is coming from the class # instead of the instance. - class Foo(object): + class Foo: "I am Foo" pass @@ -56,7 +56,7 @@ class Foo(object): def instance_attached_docstring_is_still_displayed(self): # This is actually a property of regular object semantics, but # whatever, why not have a test for it. - class Foo(object): + class Foo: "I am Foo" pass