From ba3e9fd242afe60b98ab10cb6b6b0b939030eb4c Mon Sep 17 00:00:00 2001 From: Hernan Javier Lopez Date: Sun, 3 Nov 2024 19:48:25 -0300 Subject: [PATCH 1/2] Improve readability of TestCase docstring in case.py Adjusted the indentation and formatting of the attribute list in the TestCase docstring to improve readability and avoid Sphinx documentation build errors. The attributes `failureException`, `longMessage`, and `maxDiff` are now more clearly presented with reduced indentation, making the list easier to read and avoiding issues with unexpected indentation in Sphinx. No logic or functionality was modified; this change only affects the docstring for documentation purposes. --- Lib/unittest/case.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index 55c79d353539ca..8d0eaf029a0901 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -360,7 +360,8 @@ def __iter__(self): class TestCase(object): - """A class whose instances are single test cases. + """ + A class whose instances are single test cases. By default, the test code itself should be placed in a method named 'runTest'. @@ -381,15 +382,10 @@ class TestCase(object): in order to be run. When subclassing TestCase, you can set these attributes: - * failureException: determines which exception will be raised when - the instance's assertion methods fail; test methods raising this - exception will be deemed to have 'failed' rather than 'errored'. - * longMessage: determines whether long messages (including repr of - objects used in assert methods) will be printed on failure in *addition* - to any explicit message passed. - * maxDiff: sets the maximum length of a diff in failure messages - by assert methods using difflib. It is looked up as an instance - attribute so can be configured by individual tests if required. + + * failureException: determines which exception will be raised when the instance's assertion methods fail; test methods raising this exception will be deemed to have 'failed' rather than 'errored'. + * longMessage: determines whether long messages (including repr of objects used in assert methods) will be printed on failure in *addition* to any explicit message passed. + * maxDiff: sets the maximum length of a diff in failure messages by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required. """ failureException = AssertionError From 86a3e8e99431b69083a65b4b27c393f827aedbd1 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 3 Nov 2024 22:59:14 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Documentation/2024-11-03-22-59-13.gh-issue-126378.oSRbN0.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2024-11-03-22-59-13.gh-issue-126378.oSRbN0.rst diff --git a/Misc/NEWS.d/next/Documentation/2024-11-03-22-59-13.gh-issue-126378.oSRbN0.rst b/Misc/NEWS.d/next/Documentation/2024-11-03-22-59-13.gh-issue-126378.oSRbN0.rst new file mode 100644 index 00000000000000..747a8a15bb6758 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2024-11-03-22-59-13.gh-issue-126378.oSRbN0.rst @@ -0,0 +1 @@ +Adjusted the indentation and formatting of the attribute list in the TestCase docstring to improve readability and avoid Sphinx documentation build errors.