]> crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/pyflakes/test/harness.py
Archivo de configuraciĆ³n de la terminal
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / pyflakes / test / harness.py
1 import ast
2 import textwrap
3 import unittest
4
5 from pyflakes import checker
6
7 __all__ = ['TestCase', 'skip', 'skipIf']
8
9 skip = unittest.skip
10 skipIf = unittest.skipIf
11
12
13 class 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, '''\
28 for input:
29 {}
30 expected outputs:
31 {!r}
32 but got:
33 {}'''.format(input, expectedOutputs, '\n'.join([str(o) for o in w.messages])))
34 return w