aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-09-09 22:10:07 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-09-09 22:10:07 +0200
commitc96bc5755a68d8e317d96be31b330cc0b626c194 (patch)
treebc35085a635aab4116ed4de611efa529902a5c2b /test
parent542ec502c9b9619c005bc73e562229e4547ab90b (diff)
downloadee-python-c96bc5755a68d8e317d96be31b330cc0b626c194.tar.gz
ee-python-c96bc5755a68d8e317d96be31b330cc0b626c194.tar.bz2
ee-python-c96bc5755a68d8e317d96be31b330cc0b626c194.tar.xz
ee-python-c96bc5755a68d8e317d96be31b330cc0b626c194.zip
to_bom: A utility to create a KiCAD-like xml Element of a KiCAD schematic.
Diffstat (limited to 'test')
-rw-r--r--test/test_read_schematic.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/test_read_schematic.py b/test/test_read_schematic.py
index 8edda3b..6d1add7 100644
--- a/test/test_read_schematic.py
+++ b/test/test_read_schematic.py
@@ -1,7 +1,7 @@
import pytest
import sys
import os.path
-from ee.kicad import read_schematic
+#from ee.kicad import read_schematic, to_bom
from ee import kicad
import ee
@@ -26,17 +26,32 @@ def dump_schema(sch):
for f in c.fields:
print(" {}={}".format(f.name, f.value))
+def dump_bom(sch):
+ from xml.etree import ElementTree
+ from xml.dom import minidom
+
+ print("---")
+ bom = kicad.to_bom(sch)
+ s = ElementTree.tostring(bom, encoding='unicode')
+ print(s)
+ xmlstr = minidom.parseString(s).toprettyxml(indent=" ")
+ print(xmlstr)
+ print("---")
+
def load(path):
p = basedir + "/parser/" + path
print("p={}".format(p))
- return read_schematic(p)
+ sch = kicad.read_schematic(p)
+ return sch
def test_demo_1():
sch = load("parser-demo-1.sch")
dump_schema(sch)
+ dump_bom(sch)
r101 = sch.get_component("R101")
assert r101
def test_sch():
sch = load("foo.sch")
dump_schema(sch)
+ dump_bom(sch)