aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-09-10 12:44:40 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-09-10 12:44:40 +0200
commit7f267c4aabd0a0fc5487bdf962e3c16857137c0c (patch)
treecae7de6ecf03b522e40ec20186323df0a54c9259 /test
parent0b9c68b4726a923b5b4d4141debf80db626a32a4 (diff)
downloadee-python-7f267c4aabd0a0fc5487bdf962e3c16857137c0c.tar.gz
ee-python-7f267c4aabd0a0fc5487bdf962e3c16857137c0c.tar.bz2
ee-python-7f267c4aabd0a0fc5487bdf962e3c16857137c0c.tar.xz
ee-python-7f267c4aabd0a0fc5487bdf962e3c16857137c0c.zip
o Reformat.
Diffstat (limited to 'test')
-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)