[Python-checkins] cpython: Close #18693: __dir__ removed from Enum; help() now helpful.

ethan.furman python-checkins at python.org
Sat Aug 10 22:07:58 CEST 2013


http://hg.python.org/cpython/rev/5d417257748e
changeset:   85104:5d417257748e
user:        Ethan Furman <ethan at stoneleaf.us>
date:        Sat Aug 10 13:07:49 2013 -0700
summary:
  Close #18693: __dir__ removed from Enum; help() now helpful.

files:
  Lib/enum.py           |   6 ------
  Lib/test/test_enum.py |  15 ---------------
  2 files changed, 0 insertions(+), 21 deletions(-)


diff --git a/Lib/enum.py b/Lib/enum.py
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -223,9 +223,6 @@
     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 @@
     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
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -78,21 +78,6 @@
     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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list