From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:27:48 +0000 (+0100) Subject: [3.12] gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286) (#115359) X-Git-Tag: v3.12.3~293 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ed47d8f8ba3dd8e2f992a333c4382d26ec2bf20;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286) (#115359) gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286) (cherry picked from commit 4297d7301b97aba2e0df9f9cc5fa4010e53a8950) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/test/test_dataclasses/__init__.py b/Lib/test/test_dataclasses/__init__.py index 2b09db03d4d2..639631cfb39e 100644 --- a/Lib/test/test_dataclasses/__init__.py +++ b/Lib/test/test_dataclasses/__init__.py @@ -22,6 +22,8 @@ from functools import total_ordering import typing # Needed for the string "typing.ClassVar[int]" to work as an annotation. import dataclasses # Needed for the string "dataclasses.InitVar[int]" to work as an annotation. +from test import support + # Just any custom exception we can catch. class CustomError(Exception): pass @@ -2216,6 +2218,7 @@ class TestDocString(unittest.TestCase): # whitespace stripped. self.assertEqual(a.replace(' ', ''), b.replace(' ', '')) + @support.requires_docstrings def test_existing_docstring_not_overridden(self): @dataclass class C: