Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Add tests for schematic fileformat
Browse files Browse the repository at this point in the history
  • Loading branch information
mawildoer committed Sep 13, 2024
1 parent 00c5183 commit bd03830
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions test/libs/kicad/test_fileformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@
import unittest
from pathlib import Path

import pytest

Check failure on line 8 in test/libs/kicad/test_fileformats.py

View workflow job for this annotation

GitHub Actions / test

Ruff (F401)

test/libs/kicad/test_fileformats.py:8:8: F401 `pytest` imported but unused

from faebryk.libs.kicad.fileformats import (
C_footprint,
C_kicad_footprint_file,
C_kicad_fp_lib_table_file,
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,

Check failure on line 24 in test/libs/kicad/test_fileformats.py

View workflow job for this annotation

GitHub Actions / test

Ruff (F401)

test/libs/kicad/test_fileformats.py:24:5: F401 `faebryk.libs.sexp.dataclass_sexp.sexp_field` imported but unused
)
from faebryk.libs.sexp.util import normalize_sexp_file

Check failure on line 26 in test/libs/kicad/test_fileformats.py

View workflow job for this annotation

GitHub Actions / test

Ruff (F401)

test/libs/kicad/test_fileformats.py:26:36: F401 `faebryk.libs.sexp.util.normalize_sexp_file` imported but unused
from faebryk.libs.util import NotNone, find

logger = logging.getLogger(__name__)
Expand All @@ -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
Expand Down Expand Up @@ -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"
)

Expand Down

0 comments on commit bd03830

Please sign in to comment.