summaryrefslogtreecommitdiff
path: root/gerber/tests
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-06-11 11:20:56 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-06-11 11:20:56 -0400
commit94f3976915d64a77135a1fdc8983085ee8d2e1f9 (patch)
tree353b06b7b26e5bcb6da6a08a39de24d800d73d09 /gerber/tests
parent1a70064e1097b90215e9f58b36cb31520d650eee (diff)
downloadgerbonara-94f3976915d64a77135a1fdc8983085ee8d2e1f9.tar.gz
gerbonara-94f3976915d64a77135a1fdc8983085ee8d2e1f9.tar.bz2
gerbonara-94f3976915d64a77135a1fdc8983085ee8d2e1f9.zip
Add keys to statements for linking to primitives. Add some API features to ExcellonFile, such as getting a tool path length and changing tool parameters. Excellonfiles write method generates statements based on the drill hits in the hits member, so drill hits in a generated file can be re-ordered by re-ordering the drill hits in ExcellonFile.hits. see #30
Diffstat (limited to 'gerber/tests')
-rw-r--r--gerber/tests/test_excellon.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/gerber/tests/test_excellon.py b/gerber/tests/test_excellon.py
index d47ad6a..006277d 100644
--- a/gerber/tests/test_excellon.py
+++ b/gerber/tests/test_excellon.py
@@ -24,6 +24,17 @@ def test_read():
ncdrill = read(NCDRILL_FILE)
assert(isinstance(ncdrill, ExcellonFile))
+def test_write():
+ ncdrill = read(NCDRILL_FILE)
+ ncdrill.write('test.ncd')
+ with open(NCDRILL_FILE) as src:
+ srclines = src.readlines()
+
+ with open('test.ncd') as res:
+ for idx, line in enumerate(res):
+ assert_equal(line.strip(), srclines[idx].strip())
+ os.remove('test.ncd')
+
def test_read_settings():
ncdrill = read(NCDRILL_FILE)
assert_equal(ncdrill.settings['format'], (2, 4))
@@ -47,9 +58,11 @@ def test_conversion():
ncdrill.to_metric()
assert_equal(ncdrill.settings.units, 'metric')
+ inch_primitives = ncdrill_inch.primitives
+
for tool in iter(ncdrill_inch.tools.values()):
tool.to_metric()
- for primitive in ncdrill_inch.primitives:
+ for primitive in inch_primitives:
primitive.to_metric()
for statement in ncdrill_inch.statements:
statement.to_metric()
@@ -57,7 +70,7 @@ def test_conversion():
for m_tool, i_tool in zip(iter(ncdrill.tools.values()), iter(ncdrill_inch.tools.values())):
assert_equal(i_tool, m_tool)
- for m, i in zip(ncdrill.primitives,ncdrill_inch.primitives):
+ for m, i in zip(ncdrill.primitives,inch_primitives):
assert_equal(m, i)