diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-03-05 13:33:49 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-03-05 13:33:49 -0500 |
commit | c40683b6a216f29fe473c31680ade7ab294002cd (patch) | |
tree | 2e02290c8b5e295c3e3cb933e1b60df5bc43ddbb /gerber/tests | |
parent | c542493b9b84a6af204c011bb9fc02eb43e48b2b (diff) | |
parent | 21fdb9cb57f5da938084fbf2b8133d903d0b0d77 (diff) | |
download | gerbonara-c40683b6a216f29fe473c31680ade7ab294002cd.tar.gz gerbonara-c40683b6a216f29fe473c31680ade7ab294002cd.tar.bz2 gerbonara-c40683b6a216f29fe473c31680ade7ab294002cd.zip |
Merge pull request #23 from curtacircuitos/macro-parse-eval
Add aperture macro parsing and evaluation.
Diffstat (limited to 'gerber/tests')
-rw-r--r-- | gerber/tests/test_gerber_statements.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gerber/tests/test_gerber_statements.py b/gerber/tests/test_gerber_statements.py index 04358eb..9032268 100644 --- a/gerber/tests/test_gerber_statements.py +++ b/gerber/tests/test_gerber_statements.py @@ -333,6 +333,7 @@ def test_AMParamStmt_factory(): 8,THIS IS AN UNSUPPORTED PRIMITIVE* ''') s = AMParamStmt.from_dict({'param': 'AM', 'name': name, 'macro': macro }) + s.build() assert_equal(len(s.primitives), 10) assert_true(isinstance(s.primitives[0], AMCommentPrimitive)) assert_true(isinstance(s.primitives[1], AMCirclePrimitive)) @@ -347,29 +348,34 @@ def test_AMParamStmt_factory(): def testAMParamStmt_conversion(): name = 'POLYGON' - macro = '5,1,8,25.4,25.4,25.4,0*%' + macro = '5,1,8,25.4,25.4,25.4,0*' s = AMParamStmt.from_dict({'param': 'AM', 'name': name, 'macro': macro }) + s.build() s.to_inch() assert_equal(s.primitives[0].position, (1., 1.)) assert_equal(s.primitives[0].diameter, 1.) - macro = '5,1,8,1,1,1,0*%' + macro = '5,1,8,1,1,1,0*' s = AMParamStmt.from_dict({'param': 'AM', 'name': name, 'macro': macro }) + s.build() s.to_metric() assert_equal(s.primitives[0].position, (25.4, 25.4)) assert_equal(s.primitives[0].diameter, 25.4) def test_AMParamStmt_dump(): name = 'POLYGON' - macro = '5,1,8,25.4,25.4,25.4,0*%' + macro = '5,1,8,25.4,25.4,25.4,0*' s = AMParamStmt.from_dict({'param': 'AM', 'name': name, 'macro': macro }) + s.build() + assert_equal(s.to_gerber(), '%AMPOLYGON*5,1,8,25.4,25.4,25.4,0.0*%') def test_AMParamStmt_string(): name = 'POLYGON' - macro = '5,1,8,25.4,25.4,25.4,0*%' + macro = '5,1,8,25.4,25.4,25.4,0*' s = AMParamStmt.from_dict({'param': 'AM', 'name': name, 'macro': macro }) - assert_equal(str(s), '<Aperture Macro POLYGON: 5,1,8,25.4,25.4,25.4,0*%>') + s.build() + assert_equal(str(s), '<Aperture Macro POLYGON: 5,1,8,25.4,25.4,25.4,0*>') def test_ASParamStmt_factory(): stmt = {'param': 'AS', 'mode': 'AXBY'} |