mirror of
https://github.com/python/cpython.git
synced 2025-08-13 13:29:13 +00:00
[3.12] gh-115285: Fix test_dataclasses
with -OO
mode (GH-115286) (#115359)
gh-115285: Fix `test_dataclasses` with `-OO` mode (GH-115286)
(cherry picked from commit 4297d7301b
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
8774f50e29
commit
2ed47d8f8b
1 changed files with 3 additions and 0 deletions
|
@ -22,6 +22,8 @@ from functools import total_ordering
|
||||||
import typing # Needed for the string "typing.ClassVar[int]" to work as an annotation.
|
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.
|
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.
|
# Just any custom exception we can catch.
|
||||||
class CustomError(Exception): pass
|
class CustomError(Exception): pass
|
||||||
|
|
||||||
|
@ -2216,6 +2218,7 @@ class TestDocString(unittest.TestCase):
|
||||||
# whitespace stripped.
|
# whitespace stripped.
|
||||||
self.assertEqual(a.replace(' ', ''), b.replace(' ', ''))
|
self.assertEqual(a.replace(' ', ''), b.replace(' ', ''))
|
||||||
|
|
||||||
|
@support.requires_docstrings
|
||||||
def test_existing_docstring_not_overridden(self):
|
def test_existing_docstring_not_overridden(self):
|
||||||
@dataclass
|
@dataclass
|
||||||
class C:
|
class C:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue