mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
issue23591: bool(empty_flags) == False; more docs & tests
This commit is contained in:
parent
0443953067
commit
25d94bbf05
3 changed files with 78 additions and 3 deletions
|
@ -1767,6 +1767,14 @@ class TestFlag(unittest.TestCase):
|
|||
self.assertIs(Open.WO & ~Open.WO, Open.RO)
|
||||
self.assertIs((Open.WO|Open.CE) & ~Open.WO, Open.CE)
|
||||
|
||||
def test_bool(self):
|
||||
Perm = self.Perm
|
||||
for f in Perm:
|
||||
self.assertTrue(f)
|
||||
Open = self.Open
|
||||
for f in Open:
|
||||
self.assertEqual(bool(f.value), bool(f))
|
||||
|
||||
def test_programatic_function_string(self):
|
||||
Perm = Flag('Perm', 'R W X')
|
||||
lst = list(Perm)
|
||||
|
@ -2137,6 +2145,14 @@ class TestIntFlag(unittest.TestCase):
|
|||
self.assertFalse(W in RX)
|
||||
self.assertFalse(X in RW)
|
||||
|
||||
def test_bool(self):
|
||||
Perm = self.Perm
|
||||
for f in Perm:
|
||||
self.assertTrue(f)
|
||||
Open = self.Open
|
||||
for f in Open:
|
||||
self.assertEqual(bool(f.value), bool(f))
|
||||
|
||||
class TestUnique(unittest.TestCase):
|
||||
|
||||
def test_unique_clean(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue