From 32dd5f04c5a64b43a9691c7e6ecbad3d962f4969 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 26 Oct 2025 21:40:47 +1300 Subject: [PATCH] uthelper: make str and repr generic in base class (#10985) * uthelper: make str and repr generic in base class * Update tests/unit/plugins/modules/uthelper.py --- tests/unit/plugins/modules/uthelper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/plugins/modules/uthelper.py b/tests/unit/plugins/modules/uthelper.py index 625a79d8ff..ee930744ec 100644 --- a/tests/unit/plugins/modules/uthelper.py +++ b/tests/unit/plugins/modules/uthelper.py @@ -203,6 +203,12 @@ class TestCaseMock: def build_mock(cls, mock_specs): return cls(mock_specs) + def __str__(self): + return f"<{self.__class__.__name__} specs={self.mock_specs}>" + + def __repr__(self): + return f"{self.__class__.__name__}({self.mock_specs})" + def __init__(self, mock_specs): self.mock_specs = mock_specs @@ -219,12 +225,6 @@ class TestCaseMock: class RunCommandMock(TestCaseMock): name = "run_command" - def __str__(self): - return "".format(specs=self.mock_specs) - - def __repr__(self): - return "RunCommandMock({specs})".format(specs=self.mock_specs) - def fixtures(self): @pytest.fixture def patch_bin(mocker):