void () { myFixture.configureByText(PythonFileType.INSTANCE, """ def f<caret>unc(): foo() baz.bar() return quux[42].spam + 'eggs'"""); final PsiElement element = myFixture.getElementAtCaret(); assertInstanceOf(element, PyFunction.class); final Collection<String> usedNames = PyUtil.collectUsedNames(element); assertSameElements(usedNames, "foo", "baz", "quux"); }