From b495d51354eff7b858dbbd41740865eba7f39100 Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Sun, 25 Jan 2015 14:19:48 -0500 Subject: Changed zeros/zero suppression conventions to match file format specs --- gerber/tests/test_cam.py | 27 +++++++++++++++++++++++++-- gerber/tests/test_excellon.py | 13 ++++--------- gerber/tests/test_excellon_statements.py | 14 ++++++++++++-- 3 files changed, 41 insertions(+), 13 deletions(-) (limited to 'gerber/tests') diff --git a/gerber/tests/test_cam.py b/gerber/tests/test_cam.py index ce4ec44..1aeb18c 100644 --- a/gerber/tests/test_cam.py +++ b/gerber/tests/test_cam.py @@ -64,5 +64,28 @@ def test_camfile_settings(): """ cf = CamFile() assert_equal(cf.settings, FileSettings()) - - \ No newline at end of file + +def test_zeros(): + + fs = FileSettings() + assert_equal(fs.zero_suppression, 'trailing') + assert_equal(fs.zeros, 'leading') + + + fs['zero_suppression'] = 'leading' + assert_equal(fs.zero_suppression, 'leading') + assert_equal(fs.zeros, 'trailing') + + fs.zero_suppression = 'trailing' + assert_equal(fs.zero_suppression, 'trailing') + assert_equal(fs.zeros, 'leading') + + fs['zeros'] = 'trailing' + assert_equal(fs.zeros, 'trailing') + assert_equal(fs.zero_suppression, 'leading') + + + fs.zeros= 'leading' + assert_equal(fs.zeros, 'leading') + assert_equal(fs.zero_suppression, 'trailing') + diff --git a/gerber/tests/test_excellon.py b/gerber/tests/test_excellon.py index 72e3d7d..70e4560 100644 --- a/gerber/tests/test_excellon.py +++ b/gerber/tests/test_excellon.py @@ -15,18 +15,13 @@ def test_format_detection(): """ settings = detect_excellon_format(NCDRILL_FILE) assert_equal(settings['format'], (2, 4)) - assert_equal(settings['zero_suppression'], 'leading') + assert_equal(settings['zeros'], 'trailing') def test_read(): ncdrill = read(NCDRILL_FILE) assert(isinstance(ncdrill, ExcellonFile)) - + def test_read_settings(): ncdrill = read(NCDRILL_FILE) - assert_equal(ncdrill.settings.format, (2, 4)) - assert_equal(ncdrill.settings.zero_suppression, 'leading') - - - - - + assert_equal(ncdrill.settings['format'], (2, 4)) + assert_equal(ncdrill.settings['zeros'], 'trailing') diff --git a/gerber/tests/test_excellon_statements.py b/gerber/tests/test_excellon_statements.py index 4c3201b..2e508ff 100644 --- a/gerber/tests/test_excellon_statements.py +++ b/gerber/tests/test_excellon_statements.py @@ -141,12 +141,22 @@ def test_unitstmt_factory(): line = 'INCH,LZ' stmt = UnitStmt.from_excellon(line) assert_equal(stmt.units, 'inch') - assert_equal(stmt.zero_suppression, 'trailing') + assert_equal(stmt.zeros, 'leading') + + line = 'INCH,TZ' + stmt = UnitStmt.from_excellon(line) + assert_equal(stmt.units, 'inch') + assert_equal(stmt.zeros, 'trailing') + + line = 'METRIC,LZ' + stmt = UnitStmt.from_excellon(line) + assert_equal(stmt.units, 'metric') + assert_equal(stmt.zeros, 'leading') line = 'METRIC,TZ' stmt = UnitStmt.from_excellon(line) assert_equal(stmt.units, 'metric') - assert_equal(stmt.zero_suppression, 'leading') + assert_equal(stmt.zeros, 'trailing') def test_unitstmt_dump(): -- cgit