def test_matches(): node = parse('from foo import bar').children[0] assert not array_subscript_pattern.matches(node=node) assert not function_call_pattern.matches(node=node) assert not array_subscript_pattern.matches(node=node) assert not function_call_pattern.matches(node=node) node = parse('foo[bar]\n').children[0].children[0].children[1].children[1] assert array_subscript_pattern.matches(node=node) node = parse('foo(bar)\n').children[0].children[0].children[1].children[1] assert function_call_pattern.matches(node=node)
def test_matches_py3(): node = parse('a: Optional[int] = 7\n').children[0].children[0].children[ 1].children[1].children[1].children[1] assert not array_subscript_pattern.matches(node=node)