diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-12-19 21:54:29 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-12-19 21:54:29 -0500 |
commit | 1cb269131bc52f0b1a1e69cef0466f2d994d52a8 (patch) | |
tree | 25555820946f2d7a7eac9b242bb160a883e8b0ad /gerber/tests | |
parent | 2e2b4e49c3182cc7385f12d760222ecb57cc1356 (diff) | |
download | gerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.tar.gz gerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.tar.bz2 gerbonara-1cb269131bc52f0b1a1e69cef0466f2d994d52a8.zip |
Allow negative render of soldermask per #50
Update example code and rendering to show change
Diffstat (limited to 'gerber/tests')
-rw-r--r-- | gerber/tests/test_common.py | 5 | ||||
-rw-r--r-- | gerber/tests/test_excellon.py | 42 |
2 files changed, 24 insertions, 23 deletions
diff --git a/gerber/tests/test_common.py b/gerber/tests/test_common.py index 7c66c0f..5991e5e 100644 --- a/gerber/tests/test_common.py +++ b/gerber/tests/test_common.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # Author: Hamilton Kibbe <ham@hamiltonkib.be> +from ..exceptions import ParseError from ..common import read, loads from ..excellon import ExcellonFile from ..rs274x import GerberFile @@ -31,12 +32,12 @@ def test_load_from_string(): top_copper = loads(f.read()) assert_true(isinstance(ncdrill, ExcellonFile)) assert_true(isinstance(top_copper, GerberFile)) - + def test_file_type_validation(): """ Test file format validation """ - assert_raises(TypeError, read, 'LICENSE') + assert_raises(ParseError, read, 'LICENSE') diff --git a/gerber/tests/test_excellon.py b/gerber/tests/test_excellon.py index 705adc3..a9a33c7 100644 --- a/gerber/tests/test_excellon.py +++ b/gerber/tests/test_excellon.py @@ -98,60 +98,60 @@ def test_parser_hole_sizes(): def test_parse_whitespace(): p = ExcellonParser(FileSettings()) - assert_equal(p._parse(' '), None) + assert_equal(p._parse_line(' '), None) def test_parse_comment(): p = ExcellonParser(FileSettings()) - p._parse(';A comment') + p._parse_line(';A comment') assert_equal(p.statements[0].comment, 'A comment') def test_parse_format_comment(): p = ExcellonParser(FileSettings()) - p._parse('; FILE_FORMAT=9:9 ') + p._parse_line('; FILE_FORMAT=9:9 ') assert_equal(p.format, (9, 9)) def test_parse_header(): p = ExcellonParser(FileSettings()) - p._parse('M48 ') + p._parse_line('M48 ') assert_equal(p.state, 'HEADER') - p._parse('M95 ') + p._parse_line('M95 ') assert_equal(p.state, 'DRILL') def test_parse_rout(): p = ExcellonParser(FileSettings()) - p._parse('G00 ') + p._parse_line('G00 ') assert_equal(p.state, 'ROUT') - p._parse('G05 ') + p._parse_line('G05 ') assert_equal(p.state, 'DRILL') def test_parse_version(): p = ExcellonParser(FileSettings()) - p._parse('VER,1 ') + p._parse_line('VER,1 ') assert_equal(p.statements[0].version, 1) - p._parse('VER,2 ') + p._parse_line('VER,2 ') assert_equal(p.statements[1].version, 2) def test_parse_format(): p = ExcellonParser(FileSettings()) - p._parse('FMAT,1 ') + p._parse_line('FMAT,1 ') assert_equal(p.statements[0].format, 1) - p._parse('FMAT,2 ') + p._parse_line('FMAT,2 ') assert_equal(p.statements[1].format, 2) def test_parse_units(): settings = FileSettings(units='inch', zeros='trailing') p = ExcellonParser(settings) - p._parse(';METRIC,LZ') + p._parse_line(';METRIC,LZ') assert_equal(p.units, 'inch') assert_equal(p.zeros, 'trailing') - p._parse('METRIC,LZ') + p._parse_line('METRIC,LZ') assert_equal(p.units, 'metric') assert_equal(p.zeros, 'leading') @@ -160,9 +160,9 @@ def test_parse_incremental_mode(): settings = FileSettings(units='inch', zeros='trailing') p = ExcellonParser(settings) assert_equal(p.notation, 'absolute') - p._parse('ICI,ON ') + p._parse_line('ICI,ON ') assert_equal(p.notation, 'incremental') - p._parse('ICI,OFF ') + p._parse_line('ICI,OFF ') assert_equal(p.notation, 'absolute') @@ -170,29 +170,29 @@ def test_parse_absolute_mode(): settings = FileSettings(units='inch', zeros='trailing') p = ExcellonParser(settings) assert_equal(p.notation, 'absolute') - p._parse('ICI,ON ') + p._parse_line('ICI,ON ') assert_equal(p.notation, 'incremental') - p._parse('G90 ') + p._parse_line('G90 ') assert_equal(p.notation, 'absolute') def test_parse_repeat_hole(): p = ExcellonParser(FileSettings()) p.active_tool = ExcellonTool(FileSettings(), number=8) - p._parse('R03X1.5Y1.5') + p._parse_line('R03X1.5Y1.5') assert_equal(p.statements[0].count, 3) def test_parse_incremental_position(): p = ExcellonParser(FileSettings(notation='incremental')) - p._parse('X01Y01') - p._parse('X01Y01') + p._parse_line('X01Y01') + p._parse_line('X01Y01') assert_equal(p.pos, [2.,2.]) def test_parse_unknown(): p = ExcellonParser(FileSettings()) - p._parse('Not A Valid Statement') + p._parse_line('Not A Valid Statement') assert_equal(p.statements[0].stmt, 'Not A Valid Statement') |