summaryrefslogtreecommitdiff
path: root/gerber/tests/test_cam.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2014-10-26 20:55:22 -0200
committerPaulo Henrique Silva <ph.silva@gmail.com>2014-10-26 20:55:22 -0200
commitd5c8d896d87e02d32d0c0758a09f051c141006f6 (patch)
tree50e2788e5dfc63db909a3613fff6934a0e80b153 /gerber/tests/test_cam.py
parentd0eedf3dd7ee4fbf19f51de319e48dd964b93561 (diff)
parent4f076d7b769b0f488888d268a9a199b7545afdd7 (diff)
downloadgerbonara-d5c8d896d87e02d32d0c0758a09f051c141006f6.tar.gz
gerbonara-d5c8d896d87e02d32d0c0758a09f051c141006f6.tar.bz2
gerbonara-d5c8d896d87e02d32d0c0758a09f051c141006f6.zip
Merge pull request #4 from hamiltonkibbe/master
Many fixes in parsing, rendering and new features
Diffstat (limited to 'gerber/tests/test_cam.py')
-rw-r--r--gerber/tests/test_cam.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/gerber/tests/test_cam.py b/gerber/tests/test_cam.py
new file mode 100644
index 0000000..ce4ec44
--- /dev/null
+++ b/gerber/tests/test_cam.py
@@ -0,0 +1,68 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Author: Hamilton Kibbe <ham@hamiltonkib.be>
+
+from ..cam import CamFile, FileSettings
+from tests import *
+
+
+def test_filesettings_defaults():
+ """ Test FileSettings default values
+ """
+ fs = FileSettings()
+ assert_equal(fs.format, (2, 5))
+ assert_equal(fs.notation, 'absolute')
+ assert_equal(fs.zero_suppression, 'trailing')
+ assert_equal(fs.units, 'inch')
+
+
+def test_filesettings_dict():
+ """ Test FileSettings Dict
+ """
+ fs = FileSettings()
+ assert_equal(fs['format'], (2, 5))
+ assert_equal(fs['notation'], 'absolute')
+ assert_equal(fs['zero_suppression'], 'trailing')
+ assert_equal(fs['units'], 'inch')
+
+
+def test_filesettings_assign():
+ """ Test FileSettings attribute assignment
+ """
+ fs = FileSettings()
+ fs.units = 'test1'
+ fs.notation = 'test2'
+ fs.zero_suppression = 'test3'
+ fs.format = 'test4'
+ assert_equal(fs.units, 'test1')
+ assert_equal(fs.notation, 'test2')
+ assert_equal(fs.zero_suppression, 'test3')
+ assert_equal(fs.format, 'test4')
+
+
+def test_filesettings_dict_assign():
+ """ Test FileSettings dict-style attribute assignment
+ """
+ fs = FileSettings()
+ fs['units'] = 'metric'
+ fs['notation'] = 'incremental'
+ fs['zero_suppression'] = 'leading'
+ fs['format'] = (1, 2)
+ assert_equal(fs.units, 'metric')
+ assert_equal(fs.notation, 'incremental')
+ assert_equal(fs.zero_suppression, 'leading')
+ assert_equal(fs.format, (1, 2))
+
+def test_camfile_init():
+ """ Smoke test CamFile test
+ """
+ cf = CamFile()
+
+def test_camfile_settings():
+ """ Test CamFile Default Settings
+ """
+ cf = CamFile()
+ assert_equal(cf.settings, FileSettings())
+
+ \ No newline at end of file