summaryrefslogtreecommitdiff
path: root/gerber/tests
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2014-10-07 00:16:39 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2014-10-07 00:16:39 -0400
commitf7c19398730d95bd4f34834ebcf66d9a68273055 (patch)
tree2e5204513c430019550956697c5fc4b3ad8f9f01 /gerber/tests
parent7f75e8b9e9e338f16f215b2552db9ad9a0a50781 (diff)
downloadgerbonara-f7c19398730d95bd4f34834ebcf66d9a68273055.tar.gz
gerbonara-f7c19398730d95bd4f34834ebcf66d9a68273055.tar.bz2
gerbonara-f7c19398730d95bd4f34834ebcf66d9a68273055.zip
add tests
Diffstat (limited to 'gerber/tests')
-rw-r--r--gerber/tests/test_excellon_statements.py23
-rw-r--r--gerber/tests/test_gerber_statements.py3
2 files changed, 22 insertions, 4 deletions
diff --git a/gerber/tests/test_excellon_statements.py b/gerber/tests/test_excellon_statements.py
index 3a10153..49207d3 100644
--- a/gerber/tests/test_excellon_statements.py
+++ b/gerber/tests/test_excellon_statements.py
@@ -20,7 +20,7 @@ def test_ExcellonTool_factory():
def test_ExcellonTool_dump():
- """ Test ExcellonTool to_gerber method
+ """ Test ExcellonTool to_excellon()
"""
exc_lines = ['T1F00S00C0.01200', 'T2F00S00C0.01500', 'T3F00S00C0.01968',
'T4F00S00C0.02800', 'T5F00S00C0.03300', 'T6F00S00C0.03800',
@@ -30,4 +30,23 @@ def test_ExcellonTool_dump():
for line in exc_lines:
tool = ExcellonTool.from_excellon(line, settings)
assert_equal(tool.to_excellon(), line)
- \ No newline at end of file
+
+
+def test_ToolSelectionStmt_factory():
+ """ Test ToolSelectionStmt factory method
+ """
+ stmt = ToolSelectionStmt.from_excellon('T01')
+ assert_equal(stmt.tool, 1)
+ assert_equal(stmt.compensation_index, None)
+ stmt = ToolSelectionStmt.from_excellon('T0223')
+ assert_equal(stmt.tool, 2)
+ assert_equal(stmt.compensation_index, 23)
+
+
+def test_ToolSelectionStmt_dump():
+ """ Test ToolSelectionStmt to_excellon()
+ """
+ lines = ['T01', 'T0223', 'T10', 'T09', 'T0000']
+ for line in lines:
+ stmt = ToolSelectionStmt.from_excellon(line)
+ assert_equal(stmt.to_excellon(), line)
diff --git a/gerber/tests/test_gerber_statements.py b/gerber/tests/test_gerber_statements.py
index 7495ba7..7c01130 100644
--- a/gerber/tests/test_gerber_statements.py
+++ b/gerber/tests/test_gerber_statements.py
@@ -90,7 +90,7 @@ def test_IPParamStmt_dump():
def test_OFParamStmt_factory():
""" Test OFParamStmt factory correctly handles parameters
"""
- stmt = {'param': 'OF', 'a': '0.1234567', 'b':'0.1234567'}
+ stmt = {'param': 'OF', 'a': '0.1234567', 'b': '0.1234567'}
of = OFParamStmt.from_dict(stmt)
assert_equal(of.a, 0.1234567)
assert_equal(of.b, 0.1234567)
@@ -102,4 +102,3 @@ def test_OFParamStmt_dump():
stmt = {'param': 'OF', 'a': '0.1234567', 'b': '0.1234567'}
of = OFParamStmt.from_dict(stmt)
assert_equal(of.to_gerber(), '%OFA0.123456B0.123456*%')
-