Skip to content

Commit

Permalink
Add test and fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Dec 3, 2021
1 parent 34ad8bf commit e04c091
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pylint/checkers/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ def _check_consumer(

if (
is_recursive_klass
and utils.is_inside_lambda(node)
and utils.get_node_first_ancestor_of_type(node, nodes.Lambda)
and (
not utils.is_default_argument(node)
or node.scope().parent.scope() is not defframe
Expand Down
7 changes: 7 additions & 0 deletions tests/checkers/unittest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,3 +486,10 @@ def test_is_empty_literal() -> None:
assert utils.is_empty_str_literal(string_node.value)
not_empty_string_node = astroid.extract_node("a = 'hello'")
assert not utils.is_empty_str_literal(not_empty_string_node.value)


def test_deprecation_is_inside_lambda() -> None:
"""Test that is_inside_lambda is throwing a DeprecationWarning"""
with pytest.warns(DeprecationWarning) as records:
utils.is_inside_lambda(nodes.NodeNG())
assert len(records) == 1

0 comments on commit e04c091

Please sign in to comment.