File: alerts_test.py

package info (click to toggle)
python-tatsu 5.16.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: python: 10,037; makefile: 46
file content (13 lines) | stat: -rw-r--r-- 334 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
from __future__ import annotations

from tatsu.tool import parse


def test_alert_interpolation():
    input = '42 69'
    grammar = r"""
            start = a:number b: number i:^`"seen: {a}, {b}"` $ ;
            number = /\d+/ ;
    """
    ast = parse(grammar, input)
    assert ast == {'a': '42', 'b': '69', 'i': 'seen: 42, 69'}