diff options
author | Andrew Haigh <hello@nelf.in> | 2021-06-16 21:47:45 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 13:47:45 +0200 |
commit | f3ea3153a598b9ca7dd5fc3b59a7f5f8bd32aa30 (patch) | |
tree | 3ee11627177500fb64282dc02ff8427a3cc93076 /tests/functional | |
parent | e3010e6ce84116cfdedf13ad81defec7b8aa5fcc (diff) | |
download | pylint-git-f3ea3153a598b9ca7dd5fc3b59a7f5f8bd32aa30.tar.gz |
Add regression tests for Enum.name and .value inference (#4558)
Ref #1932. Ref #2062. Ref PyCQA/astroid#1020.
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/e/enum_subclasses.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/functional/e/enum_subclasses.py b/tests/functional/e/enum_subclasses.py new file mode 100644 index 000000000..395cb24e4 --- /dev/null +++ b/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() |