mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-40066: Enum: modify repr()
and str()
(GH-22392)
* Enum: streamline repr() and str(); improve docs - repr() is now ``enum_class.member_name`` - stdlib global enums are ``module_name.member_name`` - str() is now ``member_name`` - add HOW-TO section for ``Enum`` - change main documentation to be an API reference
This commit is contained in:
parent
51a85ddce8
commit
b775106d94
19 changed files with 2225 additions and 1491 deletions
|
@ -1467,18 +1467,18 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
ABC = 'abc'
|
||||
# Testing Unicode formatting strings...
|
||||
self.assertEqual("%s, %s" % (Str.ABC, Str.ABC),
|
||||
'Str.ABC, Str.ABC')
|
||||
'ABC, 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),
|
||||
'Str.ABC, Str.ABC, 15, 15, 15, 3.141593, 3.14')
|
||||
'ABC, ABC, 15, 15, 15, 3.141593, 3.14')
|
||||
|
||||
# formatting jobs delegated from the string implementation:
|
||||
self.assertEqual('...%(foo)s...' % {'foo':Str.ABC},
|
||||
'...Str.ABC...')
|
||||
'...ABC...')
|
||||
self.assertEqual('...%(foo)s...' % {'foo':Int.IDES},
|
||||
'...Int.IDES...')
|
||||
'...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