]> crepu.dev Git - config.git/blame - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/pyflakes/test/harness.py
Configuracion en desarrollo PC pega
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / pyflakes / test / harness.py
CommitLineData
53e6db90
DC
1import ast
2import textwrap
3import unittest
4
5from pyflakes import checker
6
7__all__ = ['TestCase', 'skip', 'skipIf']
8
9skip = unittest.skip
10skipIf = unittest.skipIf
11
12
13class TestCase(unittest.TestCase):
14
15 withDoctest = False
16
17 def flakes(self, input, *expectedOutputs, **kw):
18 tree = ast.parse(textwrap.dedent(input))
19 if kw.get('is_segment'):
20 tree = tree.body[0]
21 kw.pop('is_segment')
22 w = checker.Checker(tree, withDoctest=self.withDoctest, **kw)
23 outputs = [type(o) for o in w.messages]
24 expectedOutputs = list(expectedOutputs)
25 outputs.sort(key=lambda t: t.__name__)
26 expectedOutputs.sort(key=lambda t: t.__name__)
27 self.assertEqual(outputs, expectedOutputs, '''\
28for input:
29{}
30expected outputs:
31{!r}
32but got:
33{}'''.format(input, expectedOutputs, '\n'.join([str(o) for o in w.messages])))
34 return w