diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-12-12 12:02:29 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-12-15 07:30:35 +0100 |
commit | 102614dc8fe2f5aefd0fd92c1b6e48107a9629b0 (patch) | |
tree | 341436f8afc4a29819e59b199eb629a80ffd2df0 /test | |
parent | 6cd194703674268b313918b590f2bc483c641efa (diff) | |
download | ee-python-102614dc8fe2f5aefd0fd92c1b6e48107a9629b0.tar.gz ee-python-102614dc8fe2f5aefd0fd92c1b6e48107a9629b0.tar.bz2 ee-python-102614dc8fe2f5aefd0fd92c1b6e48107a9629b0.tar.xz ee-python-102614dc8fe2f5aefd0fd92c1b6e48107a9629b0.zip |
o Adding a kicad-make-pos tool.
Diffstat (limited to 'test')
-rw-r--r-- | test/kicad_pcb/parser-1-all.pos | 9 | ||||
-rw-r--r-- | test/kicad_pcb/parser-1.kicad_pcb | 123 | ||||
-rw-r--r-- | test/test_digikey.py | 5 | ||||
-rw-r--r-- | test/test_kicad.py | 18 | ||||
-rw-r--r-- | test/test_parse_sexpr.py | 2 |
5 files changed, 94 insertions, 63 deletions
diff --git a/test/kicad_pcb/parser-1-all.pos b/test/kicad_pcb/parser-1-all.pos new file mode 100644 index 0000000..0a41e18 --- /dev/null +++ b/test/kicad_pcb/parser-1-all.pos @@ -0,0 +1,9 @@ +### Module positions - created on Fri Dec 8 21:36:06 2017 ### +### Printed by Pcbnew version kicad 4.0.7+dfsg1-1 +## Unit = mm, Angle = deg. +## Side : All +# Ref Val Package PosX PosY Rot Side +C1 C C_0603 149.8600 -106.6800 180.1000 top +R1 R R_0603 146.0500 -104.1400 0.0000 top +R2 R R_0603 146.0500 -106.6800 180.0000 top +## End diff --git a/test/kicad_pcb/parser-1.kicad_pcb b/test/kicad_pcb/parser-1.kicad_pcb index 99f5d33..9168c23 100644 --- a/test/kicad_pcb/parser-1.kicad_pcb +++ b/test/kicad_pcb/parser-1.kicad_pcb @@ -6,7 +6,7 @@ (area 137.492381 96.36 152.55 110.085) (thickness 1.6) (drawings 5) - (tracks 14) + (tracks 17) (zones 0) (modules 4) (nets 4) @@ -107,34 +107,34 @@ (add_net "Net-(J1-Pad2)") ) - (module Capacitors_SMD:C_0603 (layer F.Cu) (tedit 5A2A3416) (tstamp 5A29152D) - (at 149.86 106.68 180.1) + (module Capacitors_SMD:C_0603 (layer B.Cu) (tedit 5A2A3416) (tstamp 5A29152D) + (at 149.86 106.68 179.9) (descr "Capacitor SMD 0603, reflow soldering, AVX (see smccp.pdf)") (tags "capacitor 0603") (path /5A2915AE) (attr smd) - (fp_text reference C1 (at 0 -1.5 180.1) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) + (fp_text reference C1 (at 0 1.5 179.9) (layer B.SilkS) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) ) - (fp_text value C (at 0 1.5 180.1) (layer F.Fab) - (effects (font (size 1 1) (thickness 0.15))) + (fp_text value C (at 0 -1.5 179.9) (layer B.Fab) + (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) ) - (fp_line (start 1.4 0.65) (end -1.4 0.65) (layer F.CrtYd) (width 0.05)) - (fp_line (start 1.4 0.65) (end 1.4 -0.65) (layer F.CrtYd) (width 0.05)) - (fp_line (start -1.4 -0.65) (end -1.4 0.65) (layer F.CrtYd) (width 0.05)) - (fp_line (start -1.4 -0.65) (end 1.4 -0.65) (layer F.CrtYd) (width 0.05)) - (fp_line (start 0.35 0.6) (end -0.35 0.6) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.35 -0.6) (end 0.35 -0.6) (layer F.SilkS) (width 0.12)) - (fp_line (start -0.8 -0.4) (end 0.8 -0.4) (layer F.Fab) (width 0.1)) - (fp_line (start 0.8 -0.4) (end 0.8 0.4) (layer F.Fab) (width 0.1)) - (fp_line (start 0.8 0.4) (end -0.8 0.4) (layer F.Fab) (width 0.1)) - (fp_line (start -0.8 0.4) (end -0.8 -0.4) (layer F.Fab) (width 0.1)) - (fp_text user %R (at 0 0 180.1) (layer F.Fab) - (effects (font (size 0.3 0.3) (thickness 0.075))) + (fp_line (start 1.4 -0.65) (end -1.4 -0.65) (layer B.CrtYd) (width 0.05)) + (fp_line (start 1.4 -0.65) (end 1.4 0.65) (layer B.CrtYd) (width 0.05)) + (fp_line (start -1.4 0.65) (end -1.4 -0.65) (layer B.CrtYd) (width 0.05)) + (fp_line (start -1.4 0.65) (end 1.4 0.65) (layer B.CrtYd) (width 0.05)) + (fp_line (start 0.35 -0.6) (end -0.35 -0.6) (layer B.SilkS) (width 0.12)) + (fp_line (start -0.35 0.6) (end 0.35 0.6) (layer B.SilkS) (width 0.12)) + (fp_line (start -0.8 0.4) (end 0.8 0.4) (layer B.Fab) (width 0.1)) + (fp_line (start 0.8 0.4) (end 0.8 -0.4) (layer B.Fab) (width 0.1)) + (fp_line (start 0.8 -0.4) (end -0.8 -0.4) (layer B.Fab) (width 0.1)) + (fp_line (start -0.8 -0.4) (end -0.8 0.4) (layer B.Fab) (width 0.1)) + (fp_text user %R (at 0 0 179.9) (layer B.Fab) + (effects (font (size 0.3 0.3) (thickness 0.075)) (justify mirror)) ) - (pad 2 smd rect (at 0.75 0 180.1) (size 0.8 0.75) (layers F.Cu F.Paste F.Mask) + (pad 2 smd rect (at 0.75 0 179.9) (size 0.8 0.75) (layers B.Cu B.Paste B.Mask) (net 3 GND)) - (pad 1 smd rect (at -0.75 0 180) (size 0.8 0.75) (layers F.Cu F.Paste F.Mask) + (pad 1 smd rect (at -0.75 0 180) (size 0.8 0.75) (layers B.Cu B.Paste B.Mask) (net 1 "Net-(C1-Pad1)")) (model Capacitors_SMD.3dshapes/C_0603.wrl (at (xyz 0 0 0)) @@ -272,18 +272,21 @@ (gr_line (start 152.4 101.6) (end 152.4 109.22) (layer Edge.Cuts) (width 0.1)) (gr_line (start 139.7 101.6) (end 152.4 101.6) (layer Edge.Cuts) (width 0.1)) - (segment (start 150.61 106.68) (end 150.585 106.68) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 150.585 106.68) (end 149.884999 105.979999) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 147.3 106.68) (end 146.8 106.68) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 149.884999 105.979999) (end 148.000001 105.979999) (width 0.25) (layer F.Cu) (net 1)) - (segment (start 148.000001 105.979999) (end 147.3 106.68) (width 0.25) (layer F.Cu) (net 1)) + (segment (start 150.495 105.41) (end 150.495 106.56631) (width 0.25) (layer B.Cu) (net 1)) + (segment (start 150.495 106.56631) (end 150.609999 106.681309) (width 0.25) (layer B.Cu) (net 1)) + (segment (start 146.8 106.68) (end 149.225 106.68) (width 0.25) (layer F.Cu) (net 1)) + (segment (start 149.225 106.68) (end 150.495 105.41) (width 0.25) (layer F.Cu) (net 1)) + (via (at 150.495 105.41) (size 0.6) (drill 0.4) (layers F.Cu B.Cu) (net 1)) (segment (start 146.8 106.68) (end 146.8 106.48) (width 0.25) (layer F.Cu) (net 1)) (segment (start 146.8 106.48) (end 146.8 104.14) (width 0.25) (layer F.Cu) (net 1)) (segment (start 142.24 104.14) (end 145.3 104.14) (width 0.25) (layer F.Cu) (net 2)) - (segment (start 149.11 106.68) (end 148.085002 106.68) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 148.085002 106.68) (end 147.310001 107.455001) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 147.310001 107.455001) (end 146.289999 107.455001) (width 0.25) (layer F.Cu) (net 3)) - (segment (start 146.289999 107.455001) (end 145.514998 106.68) (width 0.25) (layer F.Cu) (net 3)) + (segment (start 149.225 107.95) (end 149.225 106.79369) (width 0.25) (layer B.Cu) (net 3)) + (segment (start 149.225 106.79369) (end 149.110001 106.678691) (width 0.25) (layer B.Cu) (net 3)) + (segment (start 145.3 106.68) (end 145.3 106.88) (width 0.25) (layer F.Cu) (net 3)) + (segment (start 145.3 106.88) (end 146.37 107.95) (width 0.25) (layer F.Cu) (net 3)) + (segment (start 146.37 107.95) (end 146.57 107.95) (width 0.25) (layer F.Cu) (net 3)) + (segment (start 146.57 107.95) (end 149.225 107.95) (width 0.25) (layer F.Cu) (net 3)) + (via (at 149.225 107.95) (size 0.6) (drill 0.4) (layers F.Cu B.Cu) (net 3)) (segment (start 145.514998 106.68) (end 143.34 106.68) (width 0.25) (layer F.Cu) (net 3)) (segment (start 143.34 106.68) (end 142.24 106.68) (width 0.25) (layer F.Cu) (net 3)) @@ -298,37 +301,35 @@ ) (filled_polygon (pts - (xy 151.715 108.535) (xy 140.385 108.535) (xy 140.385 105.83) (xy 140.74256 105.83) (xy 140.74256 107.53) - (xy 140.786838 107.765317) (xy 140.92591 107.981441) (xy 141.13811 108.126431) (xy 141.39 108.17744) (xy 143.09 108.17744) - (xy 143.325317 108.133162) (xy 143.541441 107.99409) (xy 143.686431 107.78189) (xy 143.73744 107.53) (xy 143.73744 107.44) - (xy 144.494895 107.44) (xy 144.58591 107.581441) (xy 144.79811 107.726431) (xy 145.05 107.77744) (xy 145.537636 107.77744) - (xy 145.752598 107.992402) (xy 145.99916 108.157149) (xy 146.289999 108.215001) (xy 147.310001 108.215001) (xy 147.60084 108.157149) - (xy 147.847402 107.992402) (xy 148.297864 107.54194) (xy 148.45811 107.651431) (xy 148.71 107.70244) (xy 149.51 107.70244) - (xy 149.745317 107.658162) (xy 149.859978 107.58438) (xy 149.95811 107.651431) (xy 150.21 107.70244) (xy 151.01 107.70244) - (xy 151.245317 107.658162) (xy 151.461441 107.51909) (xy 151.606431 107.30689) (xy 151.65744 107.055) (xy 151.65744 106.305) - (xy 151.613162 106.069683) (xy 151.47409 105.853559) (xy 151.26189 105.708569) (xy 151.01 105.65756) (xy 150.637362 105.65756) - (xy 150.4224 105.442598) (xy 150.175838 105.277851) (xy 149.884999 105.219999) (xy 148.000001 105.219999) (xy 147.709162 105.277851) - (xy 147.56 105.377518) (xy 147.56 104.968386) (xy 147.646431 104.84189) (xy 147.69744 104.59) (xy 147.69744 103.69) - (xy 147.653162 103.454683) (xy 147.51409 103.238559) (xy 147.30189 103.093569) (xy 147.05 103.04256) (xy 146.55 103.04256) - (xy 146.314683 103.086838) (xy 146.098559 103.22591) (xy 146.052031 103.294006) (xy 145.909698 103.151673) (xy 145.676309 103.055) - (xy 145.58375 103.055) (xy 145.425 103.21375) (xy 145.425 104.013) (xy 145.447 104.013) (xy 145.447 104.267) - (xy 145.425 104.267) (xy 145.425 105.06625) (xy 145.58375 105.225) (xy 145.676309 105.225) (xy 145.909698 105.128327) - (xy 146.04 104.998026) (xy 146.04 105.818824) (xy 146.01409 105.778559) (xy 145.80189 105.633569) (xy 145.55 105.58256) - (xy 145.05 105.58256) (xy 144.814683 105.626838) (xy 144.598559 105.76591) (xy 144.493274 105.92) (xy 143.73744 105.92) - (xy 143.73744 105.83) (xy 143.693162 105.594683) (xy 143.55409 105.378559) (xy 143.34189 105.233569) (xy 143.233893 105.211699) - (xy 143.511645 104.906924) (xy 143.681476 104.49689) (xy 143.643933 104.42575) (xy 144.415 104.42575) (xy 144.415 104.71631) - (xy 144.511673 104.949699) (xy 144.690302 105.128327) (xy 144.923691 105.225) (xy 145.01625 105.225) (xy 145.175 105.06625) - (xy 145.175 104.267) (xy 144.57375 104.267) (xy 144.415 104.42575) (xy 143.643933 104.42575) (xy 143.560155 104.267) - (xy 142.367 104.267) (xy 142.367 104.287) (xy 142.113 104.287) (xy 142.113 104.267) (xy 140.919845 104.267) - (xy 140.798524 104.49689) (xy 140.968355 104.906924) (xy 141.244501 105.209937) (xy 141.154683 105.226838) (xy 140.938559 105.36591) - (xy 140.793569 105.57811) (xy 140.74256 105.83) (xy 140.385 105.83) (xy 140.385 103.78311) (xy 140.798524 103.78311) - (xy 140.919845 104.013) (xy 142.113 104.013) (xy 142.113 102.819181) (xy 142.367 102.819181) (xy 142.367 104.013) - (xy 143.560155 104.013) (xy 143.681476 103.78311) (xy 143.590595 103.56369) (xy 144.415 103.56369) (xy 144.415 103.85425) - (xy 144.57375 104.013) (xy 145.175 104.013) (xy 145.175 103.21375) (xy 145.01625 103.055) (xy 144.923691 103.055) - (xy 144.690302 103.151673) (xy 144.511673 103.330301) (xy 144.415 103.56369) (xy 143.590595 103.56369) (xy 143.511645 103.373076) - (xy 143.121358 102.944817) (xy 142.596892 102.698514) (xy 142.367 102.819181) (xy 142.113 102.819181) (xy 141.883108 102.698514) - (xy 141.358642 102.944817) (xy 140.968355 103.373076) (xy 140.798524 103.78311) (xy 140.385 103.78311) (xy 140.385 102.285) - (xy 151.715 102.285) + (xy 151.715 108.535) (xy 149.962424 108.535) (xy 150.017192 108.480327) (xy 150.159838 108.136799) (xy 150.160162 107.764833) + (xy 150.018117 107.421057) (xy 149.788631 107.191171) (xy 150.63468 106.345122) (xy 150.680167 106.345162) (xy 151.023943 106.203117) + (xy 151.287192 105.940327) (xy 151.429838 105.596799) (xy 151.430162 105.224833) (xy 151.288117 104.881057) (xy 151.025327 104.617808) + (xy 150.681799 104.475162) (xy 150.309833 104.474838) (xy 149.966057 104.616883) (xy 149.702808 104.879673) (xy 149.560162 105.223201) + (xy 149.560121 105.270077) (xy 148.910198 105.92) (xy 147.605105 105.92) (xy 147.56 105.849905) (xy 147.56 104.968386) + (xy 147.646431 104.84189) (xy 147.69744 104.59) (xy 147.69744 103.69) (xy 147.653162 103.454683) (xy 147.51409 103.238559) + (xy 147.30189 103.093569) (xy 147.05 103.04256) (xy 146.55 103.04256) (xy 146.314683 103.086838) (xy 146.098559 103.22591) + (xy 146.052031 103.294006) (xy 145.909698 103.151673) (xy 145.676309 103.055) (xy 145.58375 103.055) (xy 145.425 103.21375) + (xy 145.425 104.013) (xy 145.447 104.013) (xy 145.447 104.267) (xy 145.425 104.267) (xy 145.425 105.06625) + (xy 145.58375 105.225) (xy 145.676309 105.225) (xy 145.909698 105.128327) (xy 146.04 104.998026) (xy 146.04 105.818824) + (xy 146.01409 105.778559) (xy 145.80189 105.633569) (xy 145.55 105.58256) (xy 145.05 105.58256) (xy 144.814683 105.626838) + (xy 144.598559 105.76591) (xy 144.493274 105.92) (xy 143.73744 105.92) (xy 143.73744 105.83) (xy 143.693162 105.594683) + (xy 143.55409 105.378559) (xy 143.34189 105.233569) (xy 143.233893 105.211699) (xy 143.511645 104.906924) (xy 143.681476 104.49689) + (xy 143.643933 104.42575) (xy 144.415 104.42575) (xy 144.415 104.71631) (xy 144.511673 104.949699) (xy 144.690302 105.128327) + (xy 144.923691 105.225) (xy 145.01625 105.225) (xy 145.175 105.06625) (xy 145.175 104.267) (xy 144.57375 104.267) + (xy 144.415 104.42575) (xy 143.643933 104.42575) (xy 143.560155 104.267) (xy 142.367 104.267) (xy 142.367 104.287) + (xy 142.113 104.287) (xy 142.113 104.267) (xy 140.919845 104.267) (xy 140.798524 104.49689) (xy 140.968355 104.906924) + (xy 141.244501 105.209937) (xy 141.154683 105.226838) (xy 140.938559 105.36591) (xy 140.793569 105.57811) (xy 140.74256 105.83) + (xy 140.74256 107.53) (xy 140.786838 107.765317) (xy 140.92591 107.981441) (xy 141.13811 108.126431) (xy 141.39 108.17744) + (xy 143.09 108.17744) (xy 143.325317 108.133162) (xy 143.541441 107.99409) (xy 143.686431 107.78189) (xy 143.73744 107.53) + (xy 143.73744 107.44) (xy 144.494895 107.44) (xy 144.58591 107.581441) (xy 144.79811 107.726431) (xy 145.05 107.77744) + (xy 145.122638 107.77744) (xy 145.832599 108.487401) (xy 145.903836 108.535) (xy 140.385 108.535) (xy 140.385 103.78311) + (xy 140.798524 103.78311) (xy 140.919845 104.013) (xy 142.113 104.013) (xy 142.113 102.819181) (xy 142.367 102.819181) + (xy 142.367 104.013) (xy 143.560155 104.013) (xy 143.681476 103.78311) (xy 143.590595 103.56369) (xy 144.415 103.56369) + (xy 144.415 103.85425) (xy 144.57375 104.013) (xy 145.175 104.013) (xy 145.175 103.21375) (xy 145.01625 103.055) + (xy 144.923691 103.055) (xy 144.690302 103.151673) (xy 144.511673 103.330301) (xy 144.415 103.56369) (xy 143.590595 103.56369) + (xy 143.511645 103.373076) (xy 143.121358 102.944817) (xy 142.596892 102.698514) (xy 142.367 102.819181) (xy 142.113 102.819181) + (xy 141.883108 102.698514) (xy 141.358642 102.944817) (xy 140.968355 103.373076) (xy 140.798524 103.78311) (xy 140.385 103.78311) + (xy 140.385 102.285) (xy 151.715 102.285) ) ) ) diff --git a/test/test_digikey.py b/test/test_digikey.py index c488ae6..e0cc9ff 100644 --- a/test/test_digikey.py +++ b/test/test_digikey.py @@ -1,7 +1,8 @@ import ee.digikey as dk +import io import os.path +import pytest import sys -import io from itertools import groupby basedir = os.path.dirname(os.path.abspath(__file__)) @@ -10,6 +11,7 @@ digikey = dk.Digikey() client = dk.DigikeyClient(digikey, on_download=print) +@pytest.mark.digikey def test_digikey_1(tmpdir): res = client.search("TCR2LF18LM(CTTR-ND") assert res.response_type == dk.SearchResponseTypes.SINGLE @@ -32,6 +34,7 @@ def test_digikey_1(tmpdir): assert x.getvalue() == y.getvalue() +@pytest.mark.digikey def test_digikey_2(tmpdir): res = client.search("TCR2LF", page_size=500) assert res.response_type == dk.SearchResponseTypes.MANY diff --git a/test/test_kicad.py b/test/test_kicad.py new file mode 100644 index 0000000..3f78f54 --- /dev/null +++ b/test/test_kicad.py @@ -0,0 +1,18 @@ +import pytest +from ee.kicad import parse_ref + +@pytest.mark.parametrize("ref,expected", [ + ("C12", ("C", 12)), + ("C12?", None), + ("C?", ("C", None)), + ("junk", None), +]) +def test_parse_ref(ref, expected): + if expected is None: + assert parse_ref(ref) is None + return + + (expected_ref, expected_num) = expected + (actual_ref, actual_num) = parse_ref(ref) + assert expected_ref == actual_ref + assert expected_num == actual_num diff --git a/test/test_parse_sexpr.py b/test/test_parse_sexpr.py index 4a97507..f64c2ef 100644 --- a/test/test_parse_sexpr.py +++ b/test/test_parse_sexpr.py @@ -9,4 +9,4 @@ def test_parsing(): count = 0 for (event, token) in sexpr.parse(path): count = count + 1 - assert count == 3657 + assert count == 3699 |