From b79bd646e74541444d6b36a92c311611ff001620 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Mon, 12 Feb 2024 21:31:07 +0300 Subject: [PATCH] gh-115285: Fix `test_dataclasses` with `-OO` mode (#115286) --- Lib/test/test_dataclasses/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_dataclasses/__init__.py b/Lib/test/test_dataclasses/__init__.py index 272d427875ae407..ede74b0dd15ccfc 100644 --- a/Lib/test/test_dataclasses/__init__.py +++ b/Lib/test/test_dataclasses/__init__.py @@ -22,6 +22,8 @@ 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 @@ def assertDocStrEqual(self, a, b): # whitespace stripped. self.assertEqual(a.replace(' ', ''), b.replace(' ', '')) + @support.requires_docstrings def test_existing_docstring_not_overridden(self): @dataclass class C: