diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:55:40 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:55:40 (GMT) |
commit | 0fe7978c68c5a1cccf00225c941767015c1ff11f (patch) | |
tree | 86aa4775ae62fd2c9e4388cc59e7a7c99130873c /Lib/test/test_enum.py | |
parent | 21a663ea2829b6808dd6981904c393332d271f8e (diff) | |
parent | de4e079d3dc3365ba66ff7bd2931d87b5dc5939d (diff) | |
download | cpython-0fe7978c68c5a1cccf00225c941767015c1ff11f.zip cpython-0fe7978c68c5a1cccf00225c941767015c1ff11f.tar.gz cpython-0fe7978c68c5a1cccf00225c941767015c1ff11f.tar.bz2 |
Issue26748: Enum classes should evaluate as True
Diffstat (limited to 'Lib/test/test_enum.py')
-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 7985948..e5e0ec0 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -254,6 +254,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): |