From 405e172395fd323cde9b65952049e1851b5210ca Mon Sep 17 00:00:00 2001 From: SET Date: Tue, 11 Aug 2020 14:46:10 -0300 Subject: [PATCH] Added test for multi-part component. Check it isn't repeated. --- tests/board_samples/kibom-test-rep.sch | 74 ++++++++++++++++++++++++++ tests/test_plot/test_int_bom.py | 13 +++++ 2 files changed, 87 insertions(+) create mode 100644 tests/board_samples/kibom-test-rep.sch diff --git a/tests/board_samples/kibom-test-rep.sch b/tests/board_samples/kibom-test-rep.sch new file mode 100644 index 00000000..59d3b7c4 --- /dev/null +++ b/tests/board_samples/kibom-test-rep.sch @@ -0,0 +1,74 @@ +EESchema Schematic File Version 4 +EELAYER 30 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "KiBom Test Schematic" +Date "2020-03-12" +Rev "A" +Comp "https://github.com/SchrodingersGat/KiBom" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +Text Notes 550 950 0 50 ~ 0 +This schematic serves as a test-file for the KiBom export script.\n\nAfter making a change to the schematic, remember to re-export the BOM to generate the intermediate .xml file\n\n(The testing framework cannot perform the netlist-export step!) +$Comp +L 74xx:74LS02 U1 +U 1 1 5F32DAD4 +P 2500 2000 +F 0 "U1" H 2500 2325 50 0000 C CNN +F 1 "74LS02" H 2500 2234 50 0000 C CNN +F 2 "" H 2500 2000 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74ls02" H 2500 2000 50 0001 C CNN + 1 2500 2000 + 1 0 0 -1 +$EndComp +$Comp +L 74xx:74LS02 U1 +U 2 1 5F32F3E6 +P 3350 2000 +F 0 "U1" H 3350 2325 50 0000 C CNN +F 1 "74LS02" H 3350 2234 50 0000 C CNN +F 2 "" H 3350 2000 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74ls02" H 3350 2000 50 0001 C CNN + 2 3350 2000 + 1 0 0 -1 +$EndComp +$Comp +L 74xx:74LS02 U1 +U 3 1 5F3307F3 +P 2500 2650 +F 0 "U1" H 2500 2975 50 0000 C CNN +F 1 "74LS02" H 2500 2884 50 0000 C CNN +F 2 "" H 2500 2650 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74ls02" H 2500 2650 50 0001 C CNN + 3 2500 2650 + 1 0 0 -1 +$EndComp +$Comp +L 74xx:74LS02 U1 +U 4 1 5F3307FD +P 3350 2650 +F 0 "U1" H 3350 2975 50 0000 C CNN +F 1 "74LS02" H 3350 2884 50 0000 C CNN +F 2 "" H 3350 2650 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74ls02" H 3350 2650 50 0001 C CNN + 4 3350 2650 + 1 0 0 -1 +$EndComp +$Comp +L 74xx:74LS02 U1 +U 5 1 5F336BFF +P 2900 3600 +F 0 "U1" H 3130 3646 50 0000 L CNN +F 1 "74LS02" H 3130 3555 50 0000 L CNN +F 2 "" H 2900 3600 50 0001 C CNN +F 3 "http://www.ti.com/lit/gpn/sn74ls02" H 2900 3600 50 0001 C CNN +F 4 "" H 2900 3600 50 0001 C CNN "Config" + 5 2900 3600 + 1 0 0 -1 +$EndComp +$EndSCHEMATC diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index 15efc8b8..9042ace2 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -524,3 +524,16 @@ def test_int_bom_no_group_csv(): check_kibom_test_netlist(rows, ref_column, len(KIBOM_TEST_COMPONENTS), KIBOM_TEST_EXCLUDE, KIBOM_TEST_COMPONENTS) check_dnc(rows, 'R7', ref_column, qty_column) ctx.clean_up() + + +def test_int_bom_repeat_csv(): + """ Multipart component """ + prj = 'kibom-test-rep' + ext = 'csv' + ctx = context.TestContextSCH('test_int_bom_repeat_csv', prj, 'int_bom_simple_csv', BOM_DIR) + ctx.run() + out = prj + '-bom.' + ext + rows, header = ctx.load_csv(out) + assert header == KIBOM_TEST_HEAD + check_kibom_test_netlist(rows, header.index(REF_COLUMN_NAME), 1, [], ['U1']) + ctx.clean_up()