blob: a7e162ecd71dedb0a2b4ece35a7bbd9c2159add1 (
plain)
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
|
# build-aux/test_kicad_sexpr.py - Tests for kicad_sexpr.py
#
# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=unused-variable
import os.path
import sys
common = os.path.abspath(os.path.dirname(__file__))
if common not in sys.path:
sys.path.insert(0, common)
import kicad_sexpr # pylint: disable=wrong-import-position
def test_unmarshal() -> None:
assert kicad_sexpr.unmarshal(r'(foo "bar")') == [kicad_sexpr.Symbol("foo"), "bar"]
def test_match() -> None:
sym = kicad_sexpr.Symbol("foo")
found = False
match sym:
case kicad_sexpr.Symbol("foo"):
found = True
assert found
found = False
match sym:
case kicad_sexpr.Symbol("bar"):
found = True
assert not found
|