diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2018-10-06 06:29:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-06 06:29:36 (GMT) |
commit | cd45385ffad8910293e5659cfe7ab036e70613b7 (patch) | |
tree | 844790c5a632c9791f744110106765476516df71 /Lib/test/test_enum.py | |
parent | 92878829c31ab2fc71c60555ce87a5f6cbc876f0 (diff) | |
download | cpython-cd45385ffad8910293e5659cfe7ab036e70613b7.zip cpython-cd45385ffad8910293e5659cfe7ab036e70613b7.tar.gz cpython-cd45385ffad8910293e5659cfe7ab036e70613b7.tar.bz2 |
bpo-34909: keep searching mixins until base class is found (GH-9737)
Diffstat (limited to 'Lib/test/test_enum.py')
-rw-r--r-- | Lib/test/test_enum.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py index aadc11f..216f7d5 100644 --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -1842,6 +1842,27 @@ class TestEnum(unittest.TestCase): self.assertEqual(ConfusedColor.RED.social(), "what's up?") self.assertTrue(issubclass(ReformedColor, int)) + def test_multiple_inherited_mixin(self): + class StrEnum(str, Enum): + def __new__(cls, *args, **kwargs): + for a in args: + if not isinstance(a, str): + raise TypeError("Enumeration '%s' (%s) is not" + " a string" % (a, type(a).__name__)) + return str.__new__(cls, *args, **kwargs) + @unique + class Decision1(StrEnum): + REVERT = "REVERT" + REVERT_ALL = "REVERT_ALL" + RETRY = "RETRY" + class MyEnum(StrEnum): + pass + @unique + class Decision2(MyEnum): + REVERT = "REVERT" + REVERT_ALL = "REVERT_ALL" + RETRY = "RETRY" + class TestOrder(unittest.TestCase): |