]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-115285: Fix `test_dataclasses` with `-OO` mode (#115286)
authorNikita Sobolev <mail@sobolevn.me>
Mon, 12 Feb 2024 18:31:07 +0000 (21:31 +0300)
committerGitHub <noreply@github.com>
Mon, 12 Feb 2024 18:31:07 +0000 (21:31 +0300)
Lib/test/test_dataclasses/__init__.py

index 272d427875ae4073114c1a985a16d80f2fcd7f60..ede74b0dd15ccfc6d45be36566f09671b6460b98 100644 (file)
@@ -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: