mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.10] bpo-44559: [Enum] revert enum module to 3.9 (GH-27010)
* [Enum] revert enum module to 3.9
This commit is contained in:
parent
000b9e803a
commit
9bf7c2d638
29 changed files with 1790 additions and 4872 deletions
|
@ -1466,23 +1466,22 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
PI = 3.1415926
|
||||
class Int(enum.IntEnum):
|
||||
IDES = 15
|
||||
class Str(enum.StrEnum):
|
||||
# StrEnum uses the value and not the name for %s etc.
|
||||
class Str(str, enum.Enum):
|
||||
ABC = 'abc'
|
||||
# Testing Unicode formatting strings...
|
||||
self.assertEqual("%s, %s" % (Str.ABC, Str.ABC),
|
||||
'abc, abc')
|
||||
'Str.ABC, Str.ABC')
|
||||
self.assertEqual("%s, %s, %d, %i, %u, %f, %5.2f" %
|
||||
(Str.ABC, Str.ABC,
|
||||
Int.IDES, Int.IDES, Int.IDES,
|
||||
Float.PI, Float.PI),
|
||||
'abc, abc, 15, 15, 15, 3.141593, 3.14')
|
||||
'Str.ABC, Str.ABC, 15, 15, 15, 3.141593, 3.14')
|
||||
|
||||
# formatting jobs delegated from the string implementation:
|
||||
self.assertEqual('...%(foo)s...' % {'foo':Str.ABC},
|
||||
'...abc...')
|
||||
'...Str.ABC...')
|
||||
self.assertEqual('...%(foo)s...' % {'foo':Int.IDES},
|
||||
'...IDES...')
|
||||
'...Int.IDES...')
|
||||
self.assertEqual('...%(foo)i...' % {'foo':Int.IDES},
|
||||
'...15...')
|
||||
self.assertEqual('...%(foo)d...' % {'foo':Int.IDES},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue