From: Nikita Sobolev Date: Mon, 12 Feb 2024 18:31:07 +0000 (+0300) Subject: gh-115285: Fix `test_dataclasses` with `-OO` mode (#115286) X-Git-Tag: v3.13.0a4~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4297d7301b97aba2e0df9f9cc5fa4010e53a8950;p=thirdparty%2FPython%2Fcpython.git gh-115285: Fix `test_dataclasses` with `-OO` mode (#115286) --- diff --git a/Lib/test/test_dataclasses/__init__.py b/Lib/test/test_dataclasses/__init__.py index 272d427875ae..ede74b0dd15c 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: