File: check_astunparse.py

package info (click to toggle)
python-astor 0.8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 304 kB
  • sloc: python: 2,348; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (2)
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
import ast

try:
    import unittest2 as unittest
except ImportError:
    import unittest

from . import test_code_gen

import astunparse


class MyTests(test_code_gen.CodegenTestCase):
    to_source = staticmethod(astunparse.unparse)

    # Just see if it'll do anything good at all
    assertSrcRoundtrips = test_code_gen.CodegenTestCase.assertAstRoundtrips

    # Don't look for exact comparison; see if ASTs match
    def assertSrcEqual(self, src1, src2):
        self.assertAstEqual(ast.parse(src1), ast.parse(src2))


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