aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test_read_schematic.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/test/test_read_schematic.py b/test/test_read_schematic.py
index 6d1add7..3943e9a 100644
--- a/test/test_read_schematic.py
+++ b/test/test_read_schematic.py
@@ -1,30 +1,23 @@
-import pytest
-import sys
import os.path
-#from ee.kicad import read_schematic, to_bom
-from ee import kicad
-import ee
+import ee.kicad as kicad
-print("type=" + str(type(kicad)))
-for x in dir(ee):
- print("x={}".format(x))
-
-
basedir = os.path.dirname(os.path.abspath(__file__))
+
def dump_schema(sch):
- print("Libraries")
- for l in sch.libraries:
- print("name: {}".format(l.name))
-
- print("Components")
- for c in sch.components:
- if c.unit != 1:
- continue
- print("REF: {}, fields={}".format(c.ref if c.unit == 1 else "{}/{}".format(c.ref, c.unit), len(c.fields)))
- for f in c.fields:
- print(" {}={}".format(f.name, f.value))
+ print("Libraries")
+ for l in sch.libraries:
+ print("name: {}".format(l.name))
+
+ print("Components")
+ for c in sch.components:
+ if c.unit != 1:
+ continue
+ print("REF: {}, fields={}".format(c.ref if c.unit == 1 else "{}/{}".format(c.ref, c.unit), len(c.fields)))
+ for f in c.fields:
+ print(" {}={}".format(f.name, f.value))
+
def dump_bom(sch):
from xml.etree import ElementTree
@@ -38,12 +31,14 @@ def dump_bom(sch):
print(xmlstr)
print("---")
+
def load(path):
p = basedir + "/parser/" + path
print("p={}".format(p))
sch = kicad.read_schematic(p)
return sch
+
def test_demo_1():
sch = load("parser-demo-1.sch")
dump_schema(sch)
@@ -51,6 +46,7 @@ def test_demo_1():
r101 = sch.get_component("R101")
assert r101
+
def test_sch():
sch = load("foo.sch")
dump_schema(sch)