From 61619c4db137370f6248af5645d2e214d8a76894 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 19 Feb 2020 09:20:12 +0100 Subject: [PATCH] Test keyword extraction --- jedi/api/refactoring.py | 2 +- test/refactor/extract_variable.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/jedi/api/refactoring.py b/jedi/api/refactoring.py index 6f294ef3..5fd4c382 100644 --- a/jedi/api/refactoring.py +++ b/jedi/api/refactoring.py @@ -14,7 +14,7 @@ _INLINE_NEEDS_BRACKET = ( ).split() _EXTRACT_USE_PARENT = _INLINE_NEEDS_BRACKET + ['trailer'] _DEFINITION_SCOPES = ('suite', 'file_input') -_NON_EXCTRACABLE = ('param', ) +_NON_EXCTRACABLE = ('param', 'keyword') class ChangedFile(object): diff --git a/test/refactor/extract_variable.py b/test/refactor/extract_variable.py index da38e135..b9848a47 100644 --- a/test/refactor/extract_variable.py +++ b/test/refactor/extract_variable.py @@ -93,3 +93,13 @@ class Foo(foo.Bar): x = foo.Bar class Foo(x): pass +# -------------------------------------------------- keyword-pass +#? 12 error {'new_name': 'x'} +def x(): pass +# ++++++++++++++++++++++++++++++++++++++++++++++++++ +Cannot extract a keyword +# -------------------------------------------------- keyword-continue +#? 5 error {'new_name': 'x'} +continue +# ++++++++++++++++++++++++++++++++++++++++++++++++++ +Cannot extract a keyword