mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-46477: [Enum] ensure Flag subclasses have correct bitwise methods (GH-30816)
This commit is contained in:
parent
976dec9b3b
commit
353e3b2820
2 changed files with 51 additions and 42 deletions
|
@ -2496,6 +2496,13 @@ class TestSpecial(unittest.TestCase):
|
|||
self.assertEqual(Some.x.value, 1)
|
||||
self.assertEqual(Some.y.value, 2)
|
||||
|
||||
def test_custom_flag_bitwise(self):
|
||||
class MyIntFlag(int, Flag):
|
||||
ONE = 1
|
||||
TWO = 2
|
||||
FOUR = 4
|
||||
self.assertTrue(isinstance(MyIntFlag.ONE | MyIntFlag.TWO, MyIntFlag), MyIntFlag.ONE | MyIntFlag.TWO)
|
||||
self.assertTrue(isinstance(MyIntFlag.ONE | 2, MyIntFlag))
|
||||
|
||||
class TestOrder(unittest.TestCase):
|
||||
"test usage of the `_order_` attribute"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue