mirror of
https://github.com/python/cpython.git
synced 2025-11-12 07:02:33 +00:00
Enum: add (re)import of Flag for doctests (GH-25118)
Fix issue with CI doctest forgetting that ``Flag`` had already been imported.
This commit is contained in:
parent
202b546442
commit
49aec1a185
1 changed files with 4 additions and 4 deletions
|
|
@ -518,7 +518,7 @@ Data Types
|
||||||
Out-of-range values cause a :exc:`ValueError` to be raised. This is the
|
Out-of-range values cause a :exc:`ValueError` to be raised. This is the
|
||||||
default for :class:`Flag`::
|
default for :class:`Flag`::
|
||||||
|
|
||||||
>>> from enum import STRICT
|
>>> from enum import Flag, STRICT
|
||||||
>>> class StrictFlag(Flag, boundary=STRICT):
|
>>> class StrictFlag(Flag, boundary=STRICT):
|
||||||
... RED = auto()
|
... RED = auto()
|
||||||
... GREEN = auto()
|
... GREEN = auto()
|
||||||
|
|
@ -535,7 +535,7 @@ Data Types
|
||||||
Out-of-range values have invalid values removed, leaving a valid *Flag*
|
Out-of-range values have invalid values removed, leaving a valid *Flag*
|
||||||
value::
|
value::
|
||||||
|
|
||||||
>>> from enum import CONFORM
|
>>> from enum import Flag, CONFORM
|
||||||
>>> class ConformFlag(Flag, boundary=CONFORM):
|
>>> class ConformFlag(Flag, boundary=CONFORM):
|
||||||
... RED = auto()
|
... RED = auto()
|
||||||
... GREEN = auto()
|
... GREEN = auto()
|
||||||
|
|
@ -548,7 +548,7 @@ Data Types
|
||||||
Out-of-range values lose their *Flag* membership and revert to :class:`int`.
|
Out-of-range values lose their *Flag* membership and revert to :class:`int`.
|
||||||
This is the default for :class:`IntFlag`::
|
This is the default for :class:`IntFlag`::
|
||||||
|
|
||||||
>>> from enum import EJECT
|
>>> from enum import Flag, EJECT
|
||||||
>>> class EjectFlag(Flag, boundary=EJECT):
|
>>> class EjectFlag(Flag, boundary=EJECT):
|
||||||
... RED = auto()
|
... RED = auto()
|
||||||
... GREEN = auto()
|
... GREEN = auto()
|
||||||
|
|
@ -561,7 +561,7 @@ Data Types
|
||||||
Out-of-range values are kept, and the *Flag* membership is kept. This is
|
Out-of-range values are kept, and the *Flag* membership is kept. This is
|
||||||
used for some stdlib flags:
|
used for some stdlib flags:
|
||||||
|
|
||||||
>>> from enum import KEEP
|
>>> from enum import Flag, KEEP
|
||||||
>>> class KeepFlag(Flag, boundary=KEEP):
|
>>> class KeepFlag(Flag, boundary=KEEP):
|
||||||
... RED = auto()
|
... RED = auto()
|
||||||
... GREEN = auto()
|
... GREEN = auto()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue