Skip to content

test_enum has duplicate test cases: function vs class based enum definitions #109774

Description

@sobolevn

Bug report

cpython/Lib/test/test_enum.py

Lines 1034 to 1047 in 5e7ea95

class TestPlainEnumClass(_EnumTests, _PlainOutputTests, unittest.TestCase):
enum_type = Enum
class TestPlainEnumFunction(_EnumTests, _PlainOutputTests, unittest.TestCase):
enum_type = Enum
class TestPlainFlagClass(_EnumTests, _PlainOutputTests, _FlagTests, unittest.TestCase):
enum_type = Flag
class TestPlainFlagFunction(_EnumTests, _PlainOutputTests, _FlagTests, unittest.TestCase):
enum_type = Flag

Looks like some cases here are just duplicates: because in some cases Function and Class tests have different enum_type definitions:

cpython/Lib/test/test_enum.py

Lines 1104 to 1109 in 5e7ea95

class TestMixedIntClass(_EnumTests, _MixedOutputTests, unittest.TestCase):
class enum_type(int, Enum): pass
class TestMixedIntFunction(_EnumTests, _MixedOutputTests, unittest.TestCase):
enum_type = Enum('enum_type', type=int)

But, some have identical. I propose to delete cases where enum_type is a duplicate.
I have a PR ready.

It was introduced in #108704
CC @ethanfurman

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

stdlibStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions