diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-09-02 23:32:32 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-09-02 23:32:32 (GMT) |
commit | 25d94bbf05f37151e7e6e3a2e1cd5af4a3e5f68c (patch) | |
tree | 910a33c185d1f732a9a7545a3e9460672b10318e /Lib/test | |
parent | 044395306702fc47e63b43d5ad961a127c19b262 (diff) | |
download | cpython-25d94bbf05f37151e7e6e3a2e1cd5af4a3e5f68c.zip cpython-25d94bbf05f37151e7e6e3a2e1cd5af4a3e5f68c.tar.gz cpython-25d94bbf05f37151e7e6e3a2e1cd5af4a3e5f68c.tar.bz2 |
issue23591: bool(empty_flags) == False; more docs & tests
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_enum.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index cfe1b18..cf704ed 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -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): |