diff --git a/jedi/api/keywords.py b/jedi/api/keywords.py index 96109e34..a29eaf1b 100644 --- a/jedi/api/keywords.py +++ b/jedi/api/keywords.py @@ -72,6 +72,8 @@ keywords_only_valid_as_leaf = ( class KeywordName(AbstractNameDefinition): + api_type = 'keyword' + def __init__(self, evaluator, name): self.string_name = name self.parent_context = evaluator.BUILTINS diff --git a/test/test_api/test_classes.py b/test/test_api/test_classes.py index 526ce47b..bd2526a9 100644 --- a/test/test_api/test_classes.py +++ b/test/test_api/test_classes.py @@ -248,6 +248,14 @@ def test_type(): for c in Script('import os; os.path.').completions(): assert c.type +def test_type_II(): + """ + GitHub Issue #833, `keyword`s are seen as `module`s + """ + for c in Script('f').completions(): + if c.name == 'for': + assert c.type == 'keyword' + class TestGotoAssignments(TestCase): """