diff --git a/Lib/test/test_dataclasses/__init__.py b/Lib/test/test_dataclasses/__init__.py index 272d427875ae40..74e364e69b40ff 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 @@ -2222,7 +2224,10 @@ class C: """Lorem ipsum""" x: int - self.assertEqual(C.__doc__, "Lorem ipsum") + if support.HAVE_DOCSTRINGS: + self.assertEqual(C.__doc__, "Lorem ipsum") + else: + self.assertEqual(C.__doc__, "C(x: int)") def test_docstring_no_fields(self): @dataclass