1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-18 03:50:30 +01:00
Files
.vim/bundle/ft_pyflakes-vim/ftplugin/python/pyflakes/pyflakes/test/harness.py
2012-02-13 21:19:34 +01:00

28 lines
673 B
Python

import textwrap
import _ast
from twisted.trial import unittest
from pyflakes import checker
class Test(unittest.TestCase):
def flakes(self, input, *expectedOutputs, **kw):
ast = compile(textwrap.dedent(input), "<test>", "exec",
_ast.PyCF_ONLY_AST)
w = checker.Checker(ast, **kw)
outputs = [type(o) for o in w.messages]
expectedOutputs = list(expectedOutputs)
outputs.sort()
expectedOutputs.sort()
self.assert_(outputs == expectedOutputs, '''\
for input:
%s
expected outputs:
%s
but got:
%s''' % (input, repr(expectedOutputs), '\n'.join([str(o) for o in w.messages])))
return w