Skip to content

Commit 1738315

Browse files
committed
[Enum] update docs, renable doc tests
1 parent 3b4b2cf commit 1738315

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Doc/library/enum.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,17 +1222,18 @@ Private names are not converted to Enum members, but remain normal attributes.
12221222
:class:`Enum` members are instances of their :class:`Enum` class, and are
12231223
normally accessed as ``EnumClass.member``. In Python versions ``3.5`` to
12241224
``3.9`` you could access members from other members -- this practice was
1225-
discouraged, and in ``3.10`` :class:`Enum` has returned to not allowing it::
1225+
discouraged, and in ``3.11`` :class:`Enum` will return to not allowing it,
1226+
while in ``3.10`` it will raise a :exc:`DeprecationWarning`::
12261227

12271228
>>> class FieldTypes(Enum):
12281229
... name = 0
12291230
... value = 1
12301231
... size = 2
12311232
...
1232-
>>> FieldTypes.value.size
1233-
Traceback (most recent call last):
1234-
...
1235-
AttributeError: FieldTypes: no attribute 'size'
1233+
>>> FieldTypes.value.size # doctest: +SKIP
1234+
DeprecationWarning: accessing one member from another is not supported,
1235+
and will be disabled in 3.11
1236+
<FieldTypes.size: 2>
12361237

12371238
.. versionchanged:: 3.5
12381239
.. versionchanged:: 3.10

Lib/test/test_enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
def load_tests(loader, tests, ignore):
2020
tests.addTests(doctest.DocTestSuite(enum))
21-
if os.path.exists('../../Doc/library/enum.rst'):
21+
if os.path.exists('Doc/library/enum.rst'):
2222
tests.addTests(doctest.DocFileSuite(
2323
'../../Doc/library/enum.rst',
2424
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,

0 commit comments

Comments
 (0)