From 7ad6c3f6acfe1fe995c9f087e7ef7a51add60afe Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Tue, 4 Jul 2017 02:11:52 -0400 Subject: Fix handling of multi-line strings per #66 --- gerber/tests/test_excellon.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'gerber/tests') diff --git a/gerber/tests/test_excellon.py b/gerber/tests/test_excellon.py index 6cddb60..d17791c 100644 --- a/gerber/tests/test_excellon.py +++ b/gerber/tests/test_excellon.py @@ -7,7 +7,7 @@ import os from ..cam import FileSettings from ..excellon import read, detect_excellon_format, ExcellonFile, ExcellonParser from ..excellon import DrillHit, DrillSlot -from ..excellon_statements import ExcellonTool +from ..excellon_statements import ExcellonTool, RouteModeStmt from .tests import * @@ -127,7 +127,7 @@ def test_parse_header(): def test_parse_rout(): p = ExcellonParser(FileSettings()) - p._parse_line('G00 ') + p._parse_line('G00X040944Y019842') assert_equal(p.state, 'ROUT') p._parse_line('G05 ') assert_equal(p.state, 'DRILL') @@ -336,4 +336,25 @@ def test_drill_slot_bounds(): assert_equal(slot.bounding_box, expected) -#def test_exce +def test_handling_multi_line_g00_and_g1(): + """Route Mode statements with coordinates on separate line are handled + """ + test_data = """ +% +M48 +M72 +T01C0.0236 +% +T01 +G00 +X040944Y019842 +M15 +G01 +X040944Y020708 +M16 +""" + uut = ExcellonParser() + uut.parse_raw(test_data) + assert_equal(len([stmt for stmt in uut.statements + if isinstance(stmt, RouteModeStmt)]), 2) + -- cgit