]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286) (#115358)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 12 Feb 2024 20:21:18 +0000 (21:21 +0100)
committerGitHub <noreply@github.com>
Mon, 12 Feb 2024 20:21:18 +0000 (20:21 +0000)
gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286)
(cherry picked from commit 4297d7301b97aba2e0df9f9cc5fa4010e53a8950)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Lib/test/test_dataclasses/__init__.py

index 682f351c6bdf5bc0c8a746b4b2ead9017932e25e..08c685ee756b305b51583637ad29ad3ca6116eca 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
 
@@ -2143,6 +2145,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: