Skip to content

Commit

Permalink
Add regression tests for Enum.name and .value inference (#4558)
Browse files Browse the repository at this point in the history
  • Loading branch information
nelfin committed Jun 16, 2021
1 parent e3010e6 commit f3ea315
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Expand Up @@ -150,6 +150,12 @@ modules are added.

* Fix error that occurred when using ``slice`` as subscript for dict.

* Reduce false-positives around inference of ``.value`` and ``.name``
properties on ``Enum`` subclasses, following an upgrade in astroid

Closes #1932
Closes #2062


What's New in Pylint 2.8.3?
===========================
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/e/enum_subclasses.py
@@ -0,0 +1,19 @@
# pylint: disable=missing-docstring
from enum import Enum, IntEnum


class Issue1932(IntEnum):
"""https://github.com/PyCQA/pylint/issues/1932"""
FOO = 1

def whats_my_name(self):
return self.name.lower()


class Issue2062(Enum):
"""https://github.com/PyCQA/pylint/issues/2062"""
FOO = 1
BAR = 2

def __str__(self):
return self.name.lower()

0 comments on commit f3ea315

Please sign in to comment.