summaryrefslogtreecommitdiff
path: root/gerber/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gerber/tests')
-rw-r--r--gerber/tests/test_excellon.py17
-rw-r--r--gerber/tests/test_ipc356.py10
2 files changed, 25 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)
diff --git a/gerber/tests/test_ipc356.py b/gerber/tests/test_ipc356.py
index 5ccc7b8..f123a38 100644
--- a/gerber/tests/test_ipc356.py
+++ b/gerber/tests/test_ipc356.py
@@ -118,3 +118,13 @@ def test_test_record():
assert_almost_equal(r.rect_x, 0.)
assert_equal(r.soldermask_info, 'primary side')
+ record_string = '317SCL COMMUNICATION-1 D 40PA00X 34000Y 20000X 600Y1200R270 '
+ r = IPC356_TestRecord.from_line(record_string, FileSettings(units='inch'))
+ assert_equal(r.feature_type, 'through-hole')
+ assert_equal(r.net_name, 'SCL')
+ assert_equal(r.id, 'COMMUNICATION')
+ assert_equal(r.pin, '1')
+ assert_almost_equal(r.hole_diameter, 0.004)
+ assert_true(r.plated)
+ assert_almost_equal(r.x_coord, 3.4)
+ assert_almost_equal(r.y_coord, 2.0)