diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:52:09 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:52:09 (GMT) |
commit | 5de67b106ac980d9fe2bbe2a40cac8265b069c55 (patch) | |
tree | a42ade70413e57ad7095cf4e15f527ec0d81ef33 /Lib/test | |
parent | b9869dfe353b116f3b8e208339c034a2ee5bc869 (diff) | |
download | cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.zip cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.tar.gz cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.tar.bz2 |
Issue26748: Enum classes should evaluate as True
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_enum.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index 5db4040..9433638 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -257,6 +257,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): |