summaryrefslogtreecommitdiff
path: root/gerber/tests/test_cam.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 00:43:08 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-02 00:43:08 -0500
commitd98d23f8b5d61bb9d20e743a3c44bf04b6b2330a (patch)
tree8e11666ac2d36aa351d28c457165a688f73f4df9 /gerber/tests/test_cam.py
parent360eddc3c421cc193716b17d33cc94d8444d64ce (diff)
downloadgerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.tar.gz
gerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.tar.bz2
gerbonara-d98d23f8b5d61bb9d20e743a3c44bf04b6b2330a.zip
More tests and bugfixes
Diffstat (limited to 'gerber/tests/test_cam.py')
-rw-r--r--gerber/tests/test_cam.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/gerber/tests/test_cam.py b/gerber/tests/test_cam.py
index 1aeb18c..8e0270c 100644
--- a/gerber/tests/test_cam.py
+++ b/gerber/tests/test_cam.py
@@ -65,8 +65,14 @@ def test_camfile_settings():
cf = CamFile()
assert_equal(cf.settings, FileSettings())
-def test_zeros():
+#def test_bounds_override():
+# cf = CamFile()
+# assert_raises(NotImplementedError, cf.bounds)
+
+def test_zeros():
+ """ Test zero/zero_suppression interaction
+ """
fs = FileSettings()
assert_equal(fs.zero_suppression, 'trailing')
assert_equal(fs.zeros, 'leading')
@@ -89,3 +95,25 @@ def test_zeros():
assert_equal(fs.zeros, 'leading')
assert_equal(fs.zero_suppression, 'trailing')
+
+def test_filesettings_validation():
+ """ Test FileSettings constructor argument validation
+ """
+ assert_raises(ValueError, FileSettings, 'absolute-ish', 'inch', None, (2, 5), None)
+ assert_raises(ValueError, FileSettings, 'absolute', 'degrees kelvin', None, (2, 5), None)
+ assert_raises(ValueError, FileSettings, 'absolute', 'inch', 'leading', (2, 5), 'leading')
+ assert_raises(ValueError, FileSettings, 'absolute', 'inch', 'following', (2, 5), None)
+ assert_raises(ValueError, FileSettings, 'absolute', 'inch', None, (2, 5), 'following')
+ assert_raises(ValueError, FileSettings, 'absolute', 'inch', None, (2, 5, 6), None)
+
+def test_key_validation():
+ fs = FileSettings()
+ assert_raises(KeyError, fs.__getitem__, 'octopus')
+ assert_raises(KeyError, fs.__setitem__, 'octopus', 'do not care')
+ assert_raises(ValueError, fs.__setitem__, 'notation', 'absolute-ish')
+ assert_raises(ValueError, fs.__setitem__, 'units', 'degrees kelvin')
+ assert_raises(ValueError, fs.__setitem__, 'zero_suppression', 'following')
+ assert_raises(ValueError, fs.__setitem__, 'zeros', 'following')
+ assert_raises(ValueError, fs.__setitem__, 'format', (2, 5, 6))
+
+