mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-95591: [Enum] use _FlagTests
base class (GH-96475)
(cherry picked from commit 9b58eaf98c
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
0e61d2b557
commit
fd118a0850
1 changed files with 4 additions and 4 deletions
|
@ -764,7 +764,7 @@ class _FlagTests:
|
||||||
def test_default_missing_with_wrong_type_value(self):
|
def test_default_missing_with_wrong_type_value(self):
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
ValueError,
|
ValueError,
|
||||||
"'RED' is not a valid TestFlag.Color",
|
"'RED' is not a valid ",
|
||||||
) as ctx:
|
) as ctx:
|
||||||
self.MainEnum('RED')
|
self.MainEnum('RED')
|
||||||
self.assertIs(ctx.exception.__context__, None)
|
self.assertIs(ctx.exception.__context__, None)
|
||||||
|
@ -773,7 +773,7 @@ class TestPlainEnum(_EnumTests, _PlainOutputTests, unittest.TestCase):
|
||||||
enum_type = Enum
|
enum_type = Enum
|
||||||
|
|
||||||
|
|
||||||
class TestPlainFlag(_EnumTests, _PlainOutputTests, unittest.TestCase):
|
class TestPlainFlag(_EnumTests, _PlainOutputTests, _FlagTests, unittest.TestCase):
|
||||||
enum_type = Flag
|
enum_type = Flag
|
||||||
|
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ class TestStrEnum(_EnumTests, _MinimalOutputTests, unittest.TestCase):
|
||||||
enum_type = StrEnum
|
enum_type = StrEnum
|
||||||
|
|
||||||
|
|
||||||
class TestIntFlag(_EnumTests, _MinimalOutputTests, unittest.TestCase):
|
class TestIntFlag(_EnumTests, _MinimalOutputTests, _FlagTests, unittest.TestCase):
|
||||||
enum_type = IntFlag
|
enum_type = IntFlag
|
||||||
|
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ class TestMixedStr(_EnumTests, _MixedOutputTests, unittest.TestCase):
|
||||||
class enum_type(str, Enum): pass
|
class enum_type(str, Enum): pass
|
||||||
|
|
||||||
|
|
||||||
class TestMixedIntFlag(_EnumTests, _MixedOutputTests, unittest.TestCase):
|
class TestMixedIntFlag(_EnumTests, _MixedOutputTests, _FlagTests, unittest.TestCase):
|
||||||
class enum_type(int, Flag): pass
|
class enum_type(int, Flag): pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue