aboutsummaryrefslogtreecommitdiff
path: root/test/test_read_schematic.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-09-09 21:04:08 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-09-09 21:04:08 +0200
commit736b7b25f913d21578e26940265b20acabf62cd9 (patch)
tree90539246b95dc94bc1a5231eb09d8a01491f767d /test/test_read_schematic.py
parent2237de33db047b43c8da84a2abe26eb3e3fe6cbe (diff)
downloadee-python-736b7b25f913d21578e26940265b20acabf62cd9.tar.gz
ee-python-736b7b25f913d21578e26940265b20acabf62cd9.tar.bz2
ee-python-736b7b25f913d21578e26940265b20acabf62cd9.tar.xz
ee-python-736b7b25f913d21578e26940265b20acabf62cd9.zip
o Splitting out read_schematic into its own file.
Diffstat (limited to 'test/test_read_schematic.py')
-rw-r--r--test/test_read_schematic.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/test_read_schematic.py b/test/test_read_schematic.py
new file mode 100644
index 0000000..8edda3b
--- /dev/null
+++ b/test/test_read_schematic.py
@@ -0,0 +1,42 @@
+import pytest
+import sys
+import os.path
+from ee.kicad import read_schematic
+
+from ee import kicad
+import ee
+
+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))
+
+def load(path):
+ p = basedir + "/parser/" + path
+ print("p={}".format(p))
+ return read_schematic(p)
+
+def test_demo_1():
+ sch = load("parser-demo-1.sch")
+ dump_schema(sch)
+ r101 = sch.get_component("R101")
+ assert r101
+
+def test_sch():
+ sch = load("foo.sch")
+ dump_schema(sch)