aboutsummaryrefslogtreecommitdiff
path: root/test/test_bom.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-09-07 21:44:16 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2017-09-07 21:44:16 +0200
commit6ea743740ff4524287e5b63a18a45bd19d2451bb (patch)
treed14ec9c5b580450b8e2db2b115be85aea48afc42 /test/test_bom.py
parenta3da99e22540c026e4acf7bdc735aa221a4dd752 (diff)
downloadee-python-6ea743740ff4524287e5b63a18a45bd19d2451bb.tar.gz
ee-python-6ea743740ff4524287e5b63a18a45bd19d2451bb.tar.bz2
ee-python-6ea743740ff4524287e5b63a18a45bd19d2451bb.tar.xz
ee-python-6ea743740ff4524287e5b63a18a45bd19d2451bb.zip
o Reformat all.
Diffstat (limited to 'test/test_bom.py')
-rw-r--r--test/test_bom.py82
1 files changed, 44 insertions, 38 deletions
diff --git a/test/test_bom.py b/test/test_bom.py
index 6da7798..fd8c6c6 100644
--- a/test/test_bom.py
+++ b/test/test_bom.py
@@ -7,58 +7,64 @@ from ee.kicad.bom.io import read_bom
basedir = os.path.dirname(os.path.abspath(__file__))
+
@pytest.mark.parametrize("s, ref, val, rest", [
("C12", "C", 12, ""),
("C12n", "C", 12, "n"),
("C", "C", sys.maxsize, ""),
("Foo", "Foo", sys.maxsize, ""),
("+3.0VA1", "+3.0VA1", sys.maxsize, ""),
- ])
+])
def test_split_ref(s, ref, val, rest):
- assert split_ref(s) == (ref, val, rest)
+ assert split_ref(s) == (ref, val, rest)
+
def test_read_bom_1():
- bom = read_bom(basedir + '/../demo/kicad/bom/A64-OlinuXino_Rev_C.xml')
- assert len(bom.get_components()) == 425
+ bom = read_bom(basedir + '/../demo/kicad/bom/A64-OlinuXino_Rev_C.xml')
+ assert len(bom.get_components()) == 425
+
def test_read_bom_2():
- bom = read_bom(basedir + '/../demo/kicad/bom/gw.xml')
- assert len(bom.get_components()) == 165
+ bom = read_bom(basedir + '/../demo/kicad/bom/gw.xml')
+ assert len(bom.get_components()) == 165
+
+ r5 = bom.get_component("R5")
+ assert r5.ref == "R5"
+ assert r5.value == "R0402_100R"
+ assert r5["value"] == "R0402_100R"
+ assert r5.footprint == "Resistors_SMD:R_0402"
+ assert r5.library.name == "gw-cache"
+ assert len(r5.fields) == 4
+ assert r5.fields["Part Number"] == "CRCW0402100RFKED"
+ assert r5["Part Number"] == "CRCW0402100RFKED"
+ assert set(
+ ['ref', 'value', 'Capacitance', 'Color', 'Description', 'Frequency', 'Impedance', 'Inductance', 'Manufacturer',
+ 'Part Number', 'Resistance']) == bom.all_field_names()
- r5 = bom.get_component("R5")
- assert r5.ref == "R5"
- assert r5.value == "R0402_100R"
- assert r5["value"] == "R0402_100R"
- assert r5.footprint == "Resistors_SMD:R_0402"
- assert r5.library.name == "gw-cache"
- assert len(r5.fields) == 4
- assert r5.fields["Part Number"] == "CRCW0402100RFKED"
- assert r5["Part Number"] == "CRCW0402100RFKED"
- assert set(['ref', 'value', 'Capacitance', 'Color', 'Description', 'Frequency', 'Impedance', 'Inductance', 'Manufacturer', 'Part Number', 'Resistance']) == bom.all_field_names()
+ assert not "foo" in r5
+ with pytest.raises(KeyError):
+ r5["foo"]
- assert not "foo" in r5
- with pytest.raises(KeyError):
- r5["foo"]
def test_read_bom_2_pandas():
- bom = read_bom(basedir + '/../demo/kicad/bom/gw.xml').to_pandas()
- assert len(bom) == 165
+ bom = read_bom(basedir + '/../demo/kicad/bom/gw.xml').to_pandas()
+ assert len(bom) == 165
- print("bom")
- print(str(bom))
- r5 = bom.loc["R5"]
- print(str(r5.index))
-# assert r5.index == "R5"
- assert r5["ref"] == "R5"
- assert r5["value"] == "R0402_100R"
- assert r5["value"] == "R0402_100R"
-# assert r5["footprint"] == "Resistors_SMD:R_0402"
-# assert r5.library.name == "gw-cache"
-# assert len(r5.fields) == 4
-# assert r5.fields["Part Number"] == "CRCW0402100RFKED"
- assert r5["Part Number"] == "CRCW0402100RFKED"
-# assert set(['ref', 'value', 'Capacitance', 'Color', 'Description', 'Frequency', 'Impedance', 'Inductance', 'Manufacturer', 'Part Number', 'Resistance']) == bom.all_field_names()
+ print("bom")
+ print(str(bom))
+ r5 = bom.loc["R5"]
+ print(str(r5.index))
+ # assert r5.index == "R5"
+ assert r5["ref"] == "R5"
+ assert r5["value"] == "R0402_100R"
+ assert r5["value"] == "R0402_100R"
+ # assert r5["footprint"] == "Resistors_SMD:R_0402"
+ # assert r5.library.name == "gw-cache"
+ # assert len(r5.fields) == 4
+ # assert r5.fields["Part Number"] == "CRCW0402100RFKED"
+ assert r5["Part Number"] == "CRCW0402100RFKED"
+ # assert set(['ref', 'value', 'Capacitance', 'Color', 'Description', 'Frequency', 'Impedance', 'Inductance', 'Manufacturer', 'Part Number', 'Resistance']) == bom.all_field_names()
- assert not "foo" in r5
- with pytest.raises(KeyError):
- r5["foo"]
+ assert not "foo" in r5
+ with pytest.raises(KeyError):
+ r5["foo"]