File: test_self.py

package info (click to toggle)
python-gast 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 260 kB
  • sloc: python: 2,208; sh: 7; makefile: 3
file content (35 lines) | stat: -rw-r--r-- 833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import glob
import os
import unittest

import gast


class SelfTestCase(unittest.TestCase):

    def setUp(self):
        self.srcs = glob.glob(os.path.join(gast.__path__[0], '*.py'))

    def testParse(self):
        for src_py in self.srcs:
            with open(src_py) as f:
                content = f.read()
            gast.parse(content)

    def testCompile(self):
        for src_py in self.srcs:
            with open(src_py) as f:
                content = f.read()
            gnode = gast.parse(content)
            compile(gast.gast_to_ast(gnode), src_py, 'exec')

    def test_unparse(self):
        for src_py in self.srcs:
            with open(src_py) as f:
                content = f.read()
            gnode = gast.parse(content)
            gast.unparse(gnode)


if __name__ == '__main__':
    unittest.main()