summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2016-04-14 06:53:45 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2016-04-14 06:53:45 (GMT)
commitde4e079d3dc3365ba66ff7bd2931d87b5dc5939d (patch)
tree92327e5bb4b244f11edffbb6a186673f373aadbd /Lib/test/test_enum.py
parent3d7497608ba8dd0b82d69944f484febdad7dc507 (diff)
parent5de67b106ac980d9fe2bbe2a40cac8265b069c55 (diff)
downloadcpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.zip
cpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.tar.gz
cpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.tar.bz2
Issue26748: Enum classes should evaluate as True
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r--Lib/test/test_enum.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index 4b5d0d0..a59a049 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -253,6 +253,19 @@ class TestEnum(unittest.TestCase):
with self.assertRaises(AttributeError):
del Season.SPRING.name
+ def test_bool_of_class(self):
+ class Empty(Enum):
+ pass
+ self.assertTrue(bool(Empty))
+
+ def test_bool_of_member(self):
+ class Count(Enum):
+ zero = 0
+ one = 1
+ two = 2
+ for member in Count:
+ self.assertTrue(bool(member))
+
def test_invalid_names(self):
with self.assertRaises(ValueError):
class Wrong(Enum):