Commit 53f58dbd authored by Ethan Furman's avatar Ethan Furman

Close #18693: __dir__ removed from Enum; help() now helpful.

parent a4998a70
......@@ -223,9 +223,6 @@ class EnumMeta(type):
def __contains__(cls, member):
return isinstance(member, cls) and member.name in cls._member_map_
def __dir__(self):
return ['__class__', '__doc__', '__members__'] + self._member_names_
@property
def __members__(cls):
"""Returns a mapping of member name->value.
......@@ -433,9 +430,6 @@ class Enum(metaclass=EnumMeta):
def __str__(self):
return "%s.%s" % (self.__class__.__name__, self._name_)
def __dir__(self):
return (['__class__', '__doc__', 'name', 'value'])
def __eq__(self, other):
if type(other) is self.__class__:
return self is other
......
......@@ -78,21 +78,6 @@ class TestEnum(unittest.TestCase):
def test_intenum_value(self):
self.assertEqual(IntStooges.CURLY.value, 2)
def test_dir_on_class(self):
Season = self.Season
self.assertEqual(
set(dir(Season)),
set(['__class__', '__doc__', '__members__',
'SPRING', 'SUMMER', 'AUTUMN', 'WINTER']),
)
def test_dir_on_item(self):
Season = self.Season
self.assertEqual(
set(dir(Season.WINTER)),
set(['__class__', '__doc__', 'name', 'value']),
)
def test_enum(self):
Season = self.Season
lst = list(Season)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment