summaryrefslogtreecommitdiff
path: root/gerber/tests/test_gerber_statements.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-03-05 14:43:30 -0300
commita13b981c1c2ea9ede39e9821d9ba818566f044de (patch)
treed7e1507bd389623e077da0d497b419edcfd9e53f /gerber/tests/test_gerber_statements.py
parent670d3fbbd7ebfb69bd223ac30b73ec47b195b380 (diff)
downloadgerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.gz
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.tar.bz2
gerbonara-a13b981c1c2ea9ede39e9821d9ba818566f044de.zip
Fix tests for macros with no variables.
All AM*Primitive classes now handles float for all but the code modifiers. This simplifies the reading/parsing.
Diffstat (limited to 'gerber/tests/test_gerber_statements.py')
-rw-r--r--gerber/tests/test_gerber_statements.py16
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'}