void () { List<List<PsiComment>> blocks; blocks = getPrecedingImportBlocks(""" # comment # comment # comment def func():\s pass"""); assertSize(2, blocks); assertSize(1, blocks.get(0)); assertSize(2, blocks.get(1)); blocks = getPrecedingImportBlocks(""" # comment # comment # comment def func():\s pass"""); assertSize(3, blocks); assertSize(1, blocks.get(0)); assertSize(2, blocks.get(1)); assertSize(0, blocks.get(2)); blocks = getPrecedingImportBlocks("def func(): \n" + " pass"); assertSize(0, blocks); blocks = getPrecedingImportBlocks(""" # comment x = 42 def func():\s pass"""); assertSize(0, blocks); blocks = getPrecedingImportBlocks(""" # comment x = 42 # comment def func():\s pass"""); assertSize(1, blocks); assertSize(1, blocks.get(0)); }