From 3a6550cf070b0230ced1e74d3c2d86a04cda9c06 Mon Sep 17 00:00:00 2001 From: SET Date: Tue, 11 Aug 2020 18:58:17 -0300 Subject: [PATCH] Added test for `test_regex` --- tests/test_plot/test_int_bom.py | 16 ++++++++++++++++ .../int_bom_no_include_only.kiplot.yaml | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/yaml_samples/int_bom_no_include_only.kiplot.yaml diff --git a/tests/test_plot/test_int_bom.py b/tests/test_plot/test_int_bom.py index d49a8cbb..bdb12485 100644 --- a/tests/test_plot/test_int_bom.py +++ b/tests/test_plot/test_int_bom.py @@ -27,6 +27,7 @@ Tests of Internal BoM files - Don't group components - Multipart component (not repeated) - Field collision +- test_regex/exclude_any/include_only Missing: - Variants @@ -574,3 +575,18 @@ def test_int_bom_include_only(): check_kibom_test_netlist(rows, ref_column, 3, KIBOM_TEST_EXCLUDE, ['R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8']) check_dnc(rows, 'R7', ref_column, qty_column) ctx.clean_up() + + +def test_int_bom_no_test_regex(): + prj = 'kibom-test' + ext = 'csv' + ctx = context.TestContextSCH('test_int_bom_simple_csv', prj, 'int_bom_no_include_only', BOM_DIR) + ctx.run() + out = prj + '-bom.' + ext + rows, header = ctx.load_csv(out) + assert header == KIBOM_TEST_HEAD + ref_column = header.index(REF_COLUMN_NAME) + qty_column = header.index(QTY_COLUMN_NAME) + check_kibom_test_netlist(rows, ref_column, KIBOM_TEST_GROUPS, KIBOM_TEST_EXCLUDE, KIBOM_TEST_COMPONENTS) + check_dnc(rows, 'R7', ref_column, qty_column) + ctx.clean_up() diff --git a/tests/yaml_samples/int_bom_no_include_only.kiplot.yaml b/tests/yaml_samples/int_bom_no_include_only.kiplot.yaml new file mode 100644 index 00000000..c3c90dd1 --- /dev/null +++ b/tests/yaml_samples/int_bom_no_include_only.kiplot.yaml @@ -0,0 +1,14 @@ +# Example KiPlot config file +kiplot: + version: 1 + +outputs: + - name: 'bom_internal' + comment: "Bill of Materials in CSV format" + type: bom + dir: BoM + options: + test_regex: false + include_only: + - column: 'Footprint' + regex: '0805'