File: test_smoke.py

package info (click to toggle)
python-fissix 24.4.24-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,156 kB
  • sloc: python: 16,578; sh: 56; makefile: 48
file content (28 lines) | stat: -rw-r--r-- 617 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
# Copyright 2022 Amethyst Reese
# Licensed under the PSF license V2

import logging
from unittest import TestCase

from fissix import pygram, pytree
from fissix.pgen2 import driver

log = logging.getLogger(__name__)


class SmokeTest(TestCase):
    def setUp(self):
        self.grammar = pygram.python_grammar
        self.driver = driver.Driver(self.grammar, convert=pytree.convert, logger=log)

    def test_parse_string(self):
        code = """
from foo import bar

value = 123
print(bar(f"123"))

if new_value := some_func(value):
    value = new_value
        """
        tree = self.driver.parse_string(code)