void () { myFixture.configureByFile("/refactoring/dependenciesTest.py"); final PyClass clazz = getClassByName("Foo"); @SuppressWarnings("ConstantConditions") // Can't be null (class has docstring) PsiElement docStringExpression = clazz.getDocStringExpression().getParent(); PyFunction method = clazz.getMethods()[0]; PsiElement classField = clazz.getClassAttributes().get(0).getParent(); final List<PyStatement> elementList = new ArrayList<>(Arrays.asList(clazz.getStatementList().getStatements())); Collections.sort(elementList, PyDependenciesComparator.INSTANCE); Assert.assertThat("Members returned in wrong order", elementList, Matchers.contains( docStringExpression, classField, method )); }