From bd03830d6f9ab421c51f41eafbcbe2895c416f54 Mon Sep 17 00:00:00 2001 From: Matthew Wildoer Date: Thu, 12 Sep 2024 18:34:49 -0700 Subject: [PATCH] Add tests for schematic fileformat --- test/libs/kicad/test_fileformats.py | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/test/libs/kicad/test_fileformats.py b/test/libs/kicad/test_fileformats.py index 5192a3ed..db53c680 100644 --- a/test/libs/kicad/test_fileformats.py +++ b/test/libs/kicad/test_fileformats.py @@ -5,6 +5,8 @@ import unittest from pathlib import Path +import pytest + from faebryk.libs.kicad.fileformats import ( C_footprint, C_kicad_footprint_file, @@ -12,10 +14,16 @@ C_kicad_netlist_file, C_kicad_pcb_file, C_kicad_project_file, - C_kicad_sch_file, ) +from faebryk.libs.kicad.fileformats_sch import C_kicad_sch_file from faebryk.libs.logging import setup_basic_logging -from faebryk.libs.sexp.dataclass_sexp import JSON_File, SEXP_File, dataclass_dfs +from faebryk.libs.sexp.dataclass_sexp import ( + JSON_File, + SEXP_File, + dataclass_dfs, + sexp_field, +) +from faebryk.libs.sexp.util import normalize_sexp_file from faebryk.libs.util import NotNone, find logger = logging.getLogger(__name__) @@ -41,15 +49,13 @@ def test_parser(self): pro = C_kicad_project_file.loads(PRJFILE) sch = C_kicad_sch_file.loads(SCHFILE) - self.assertEqual( - [f.name for f in pcb.kicad_pcb.footprints], - [ - "logos:faebryk_logo", - "lcsc:LED0603-RD-YELLOW", - "lcsc:R0402", - "lcsc:BAT-TH_BS-02-A1AJ010", - ], - ) + assert [f.name for f in pcb.kicad_pcb.footprints] == [ + "logos:faebryk_logo", + "lcsc:LED0603-RD-YELLOW", + "lcsc:R0402", + "lcsc:BAT-TH_BS-02-A1AJ010", + ] + self.assertFalse(pcb.kicad_pcb.setup.pcbplotparams.usegerberextensions) padtype = pcb.C_kicad_pcb.C_pcb_footprint.C_pad.E_type @@ -82,7 +88,7 @@ def test_parser(self): self.assertEqual(pro.pcbnew.last_paths.netlist, "../../faebryk/faebryk.net") self.assertEqual( - sch.kicad_sch.lib_symbols.symbols["Amplifier_Audio:LM4990ITL"].properties[3].value, + sch.kicad_sch.lib_symbols.symbol["Amplifier_Audio:LM4990ITL"].propertys[3].value, "http://www.ti.com/lit/ds/symlink/lm4990.pdf" )