Added test for the connectors grouping.

This commit is contained in:
Salvador E. Tropea 2020-08-01 16:07:51 -03:00
parent 6b9be4a2fc
commit 9c8830eefa
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,64 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date ""
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L Connector:Conn_01x06_Male J1
U 1 1 5F170FD6
P 2950 2150
F 0 "J1" H 3058 2531 50 0000 C CNN
F 1 "Bizarre Bus" H 3058 2440 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 2950 2150 50 0001 C CNN
F 3 "~" H 2950 2150 50 0001 C CNN
F 4 "1x6" H 2950 2150 50 0001 C CNN "Description"
1 2950 2150
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x06_Male J2
U 1 1 5F1718A4
P 3850 2150
F 0 "J2" H 3958 2531 50 0000 C CNN
F 1 "Output crazy" H 3958 2440 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 3850 2150 50 0001 C CNN
F 3 "~" H 3850 2150 50 0001 C CNN
F 4 "1x6" H 3850 2150 50 0001 C CNN "Description"
1 3850 2150
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x04_Female J4
U 1 1 5F172308
P 4050 2850
F 0 "J4" H 4078 2826 50 0000 L CNN
F 1 "Another connector" H 4078 2735 50 0000 L CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 4050 2850 50 0001 C CNN
F 3 "~" H 4050 2850 50 0001 C CNN
F 4 "1x4" H 4050 2850 50 0001 C CNN "Description"
1 4050 2850
1 0 0 -1
$EndComp
$Comp
L Connector:Conn_01x04_Female J3
U 1 1 5F172BD1
P 2900 2850
F 0 "J3" H 2928 2826 50 0000 L CNN
F 1 "Bla bla connector" H 2928 2735 50 0000 L CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Horizontal" H 2900 2850 50 0001 C CNN
F 3 "~" H 2900 2850 50 0001 C CNN
F 4 "1x4" H 2900 2850 50 0001 C CNN "Description"
1 2900 2850
1 0 0 -1
$EndComp
$EndSCHEMATC

View File

@ -31,6 +31,7 @@ COMP_COLUMN_NAME_R = 'Renglón'
KIBOM_TEST_HEAD = [COMP_COLUMN_NAME , 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME,
'Datasheet', 'Config']
KIBOM_RENAME_HEAD = [COMP_COLUMN_NAME_R, REF_COLUMN_NAME_R, 'Componente', 'Valor', 'Código Digi-Key', 'Cantidad por PCB']
CONN_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Datasheet']
KIBOM_TEST_COMPONENTS = ['C1', 'C2', 'C3', 'C4', 'R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8', 'R9', 'R10']
KIBOM_TEST_COMPONENTS_ALT = ['C1-C4', 'R9-R10', 'R7', 'R8', 'R1-R5']
KIBOM_TEST_EXCLUDE = ['R6']
@ -394,3 +395,30 @@ def test_int_bom_column_rename_xlsx():
check_kibom_test_netlist(rows, ref_column, LINKS_GROUPS, LINKS_EXCLUDE, LINKS_COMPONENTS)
ctx.clean_up()
def test_int_group_connectors():
""" Default behavior, ignore the 'Value' for connectors """
prj = 'connectors'
ext = 'csv'
ctx = context.TestContextSCH('test_int_group_connectors', prj, 'int_bom_simple_csv', BOM_DIR)
ctx.run()
out = prj + '-bom.' + ext
rows, header = ctx.load_csv(out)
assert header == CONN_HEAD
ref_column = header.index(REF_COLUMN_NAME)
check_kibom_test_netlist(rows, ref_column, 2, [], ['J4', 'J1', 'J3', 'J2'])
ctx.clean_up()
def test_int_no_group_connectors():
""" group_connectors: false """
prj = 'connectors'
ext = 'csv'
ctx = context.TestContextSCH('test_int_no_group_connectors', prj, 'int_bom_no_group_connectors', BOM_DIR)
ctx.run()
out = prj + '-bom.' + ext
rows, header = ctx.load_csv(out)
assert header == CONN_HEAD
ref_column = header.index(REF_COLUMN_NAME)
check_kibom_test_netlist(rows, ref_column, 4, [], ['J4', 'J1', 'J3', 'J2'])
ctx.clean_up()

View File

@ -0,0 +1,13 @@
# Example KiPlot config file
kiplot:
version: 1
outputs:
- name: 'bom_internal'
comment: "Bill of Materials in CSV format"
type: bom
dir: BoM
options:
group_connectors: false
format: CSV