mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Add __reversed__ to Enum. Minor code reorg (moved __members__ to be in alpha order).
This commit is contained in:
parent
5589bd109a
commit
2131a4a2fc
2 changed files with 20 additions and 10 deletions
|
@ -477,6 +477,13 @@ class TestEnum(unittest.TestCase):
|
|||
[Season.SUMMER, Season.WINTER, Season.AUTUMN, Season.SPRING],
|
||||
)
|
||||
|
||||
def test_reversed_iteration_order(self):
|
||||
self.assertEqual(
|
||||
list(reversed(self.Season)),
|
||||
[self.Season.WINTER, self.Season.AUTUMN, self.Season.SUMMER,
|
||||
self.Season.SPRING]
|
||||
)
|
||||
|
||||
def test_programatic_function_string(self):
|
||||
SummerMonth = Enum('SummerMonth', 'june july august')
|
||||
lst = list(SummerMonth)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue