diff --git a/AUTHORS.txt b/AUTHORS.txt index 5171a933b..349a867be 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -64,6 +64,7 @@ Code Contributors - Joseph Birkner (@josephbirkner) - Márcio Mazza (@marciomazza) - Martin Vielsmaier (@moser) +- TingJia Wu (@WutingjiaX) And a few more "anonymous" contributors. diff --git a/jedi/inference/syntax_tree.py b/jedi/inference/syntax_tree.py index 39503a658..a4f3e1210 100644 --- a/jedi/inference/syntax_tree.py +++ b/jedi/inference/syntax_tree.py @@ -645,7 +645,10 @@ def _infer_comparison_part(inference_state, context, left, operator, right): _bool_to_value(inference_state, False) ]) elif str_operator in ('in', 'not in'): - return NO_VALUES + return ValueSet([ + _bool_to_value(inference_state, True), + _bool_to_value(inference_state, False) + ]) def check(obj): """Checks if a Jedi object is either a float or an int.""" diff --git a/test/test_api/test_api.py b/test/test_api/test_api.py index 55feaf8bb..5f5952210 100644 --- a/test/test_api/test_api.py +++ b/test/test_api/test_api.py @@ -403,3 +403,8 @@ def test_infer_after_parentheses(Script, code, column, expected): assert completions == [] else: assert [c.name for c in completions] == [expected] + + +def test_infer_in_operator(Script): + completions = Script("res = 'f' in 'foo'").infer(column=1) + assert completions[0].full_name == 'builtins.bool'