summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-12-26 18:15:33 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-12-26 19:12:13 +0100
commit249479692365b93ac0bf7a5765726f5270a1d39e (patch)
treea57ca54363799a15c70d41982d98e67b45ec61eb /tests
parent2f889b7d311fd97d991ec743e3c7f58796613415 (diff)
downloadastroid-git-249479692365b93ac0bf7a5765726f5270a1d39e.tar.gz
Do not crash when encountering starred assignments in enums.
Close #835
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest_brain.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py
index b42fa03f..8b73fa5c 100644
--- a/tests/unittest_brain.py
+++ b/tests/unittest_brain.py
@@ -841,6 +841,16 @@ class EnumBrainTest(unittest.TestCase):
assert inferred_tuple_node.as_string() == "(1, 2)"
assert inferred_list_node.as_string() == "[2, 4]"
+ def test_enum_starred_is_skipped(self):
+ code = """
+ from enum import Enum
+ class ContentType(Enum):
+ TEXT, PHOTO, VIDEO, GIF, YOUTUBE, *_ = [1, 2, 3, 4, 5, 6]
+ ContentType.TEXT #@
+ """
+ node = astroid.extract_node(code)
+ next(node.infer())
+
@unittest.skipUnless(HAS_DATEUTIL, "This test requires the dateutil library.")
class DateutilBrainTest(unittest.TestCase):