summaryrefslogtreecommitdiff
path: root/gerber/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gerber/tests')
-rw-r--r--gerber/tests/test_am_statements.py4
-rw-r--r--gerber/tests/test_cam.py11
-rw-r--r--gerber/tests/test_primitives.py18
3 files changed, 28 insertions, 5 deletions
diff --git a/gerber/tests/test_am_statements.py b/gerber/tests/test_am_statements.py
index c5ae6ae..98a7332 100644
--- a/gerber/tests/test_am_statements.py
+++ b/gerber/tests/test_am_statements.py
@@ -165,6 +165,7 @@ def test_AMOUtlinePrimitive_dump():
assert_equal(o.to_gerber().replace('\n', ''), '4,1,3,0,0,3,3,3,0,0,0,0*')
+
def test_AMOutlinePrimitive_conversion():
o = AMOutlinePrimitive(
4, 'on', (0, 0), [(25.4, 25.4), (25.4, 0), (0, 0)], 0)
@@ -259,6 +260,7 @@ def test_AMThermalPrimitive_validation():
assert_raises(TypeError, AMThermalPrimitive, 7, (0.0, '0'), 7, 5, 0.2, 0.0)
+
def test_AMThermalPrimitive_factory():
t = AMThermalPrimitive.from_gerber('7,0,0,7,6,0.2,45*')
assert_equal(t.code, 7)
@@ -269,11 +271,13 @@ def test_AMThermalPrimitive_factory():
assert_equal(t.rotation, 45)
+
def test_AMThermalPrimitive_dump():
t = AMThermalPrimitive.from_gerber('7,0,0,7,6,0.2,30*')
assert_equal(t.to_gerber(), '7,0,0,7.0,6.0,0.2,30.0*')
+
def test_AMThermalPrimitive_conversion():
t = AMThermalPrimitive(7, (25.4, 25.4), 25.4, 25.4, 25.4, 0.0)
t.to_inch()
diff --git a/gerber/tests/test_cam.py b/gerber/tests/test_cam.py
index 24f2b9b..a557e8c 100644
--- a/gerber/tests/test_cam.py
+++ b/gerber/tests/test_cam.py
@@ -116,6 +116,7 @@ def test_zeros():
def test_filesettings_validation():
""" Test FileSettings constructor argument validation
"""
+<<<<<<< HEAD
# absolute-ish is not a valid notation
assert_raises(ValueError, FileSettings, 'absolute-ish',
'inch', None, (2, 5), None)
@@ -132,6 +133,16 @@ def test_filesettings_validation():
#assert_raises(ValueError, FileSettings, 'absolute',
# 'inch', 'following', (2, 5), None)
+=======
+ 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)
+>>>>>>> 5476da8... Fix a bunch of rendering bugs.
assert_raises(ValueError, FileSettings, 'absolute',
'inch', None, (2, 5), 'following')
assert_raises(ValueError, FileSettings, 'absolute',
diff --git a/gerber/tests/test_primitives.py b/gerber/tests/test_primitives.py
index e23d5f4..c49b558 100644
--- a/gerber/tests/test_primitives.py
+++ b/gerber/tests/test_primitives.py
@@ -204,7 +204,8 @@ def test_arc_bounds():
def test_arc_conversion():
c = Circle((0, 0), 25.4, units='metric')
- a = Arc((2.54, 25.4), (254.0, 2540.0), (25400.0, 254000.0),'clockwise', c, 'single-quadrant', units='metric')
+ a = Arc((2.54, 25.4), (254.0, 2540.0), (25400.0, 254000.0),
+ 'clockwise', c, 'single-quadrant', units='metric')
# No effect
a.to_metric()
@@ -227,7 +228,8 @@ def test_arc_conversion():
assert_equal(a.aperture.diameter, 1.0)
c = Circle((0, 0), 1.0, units='inch')
- a = Arc((0.1, 1.0), (10.0, 100.0), (1000.0, 10000.0),'clockwise', c, 'single-quadrant', units='inch')
+ a = Arc((0.1, 1.0), (10.0, 100.0), (1000.0, 10000.0),
+ 'clockwise', c, 'single-quadrant', units='inch')
a.to_metric()
assert_equal(a.start, (2.54, 25.4))
assert_equal(a.end, (254.0, 2540.0))
@@ -254,12 +256,14 @@ def test_circle_radius():
c = Circle((1, 1), 2)
assert_equal(c.radius, 1)
+
def test_circle_hole_radius():
""" Test Circle primitive hole radius calculation
"""
c = Circle((1, 1), 4, 2)
assert_equal(c.hole_radius, 1)
+
def test_circle_bounds():
""" Test Circle bounding box calculation
"""
@@ -301,7 +305,7 @@ def test_circle_conversion():
assert_equal(c.diameter, 10.)
assert_equal(c.hole_diameter, 5.)
- #no effect
+ # no effect
c.to_inch()
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
@@ -338,13 +342,14 @@ def test_circle_conversion():
assert_equal(c.diameter, 254.)
assert_equal(c.hole_diameter, 127.)
- #no effect
+ # no effect
c.to_metric()
assert_equal(c.position, (2.54, 25.4))
assert_equal(c.diameter, 254.)
assert_equal(c.hole_diameter, 127.)
+
def test_circle_offset():
c = Circle((0, 0), 1)
c.offset(1, 0)
@@ -443,6 +448,7 @@ def test_rectangle_hole_radius():
assert_equal(0.5, r.hole_radius)
+
def test_rectangle_bounds():
""" Test rectangle bounding box calculation
"""
@@ -530,7 +536,7 @@ def test_rectangle_conversion():
assert_equal(r.hole_diameter, 127.0)
r.to_metric()
- assert_equal(r.position, (2.54,25.4))
+ assert_equal(r.position, (2.54, 25.4))
assert_equal(r.width, 254.0)
assert_equal(r.height, 2540.0)
assert_equal(r.hole_diameter, 127.0)
@@ -881,6 +887,7 @@ def test_polygon_ctor():
assert_equal(p.hole_diameter, hole_diameter)
+
def test_polygon_bounds():
""" Test polygon bounding box calculation
"""
@@ -1201,6 +1208,7 @@ def test_drill_ctor_validation():
assert_raises(TypeError, Drill, 3, 5, None)
assert_raises(TypeError, Drill, (3,4,5), 5, None)
+
def test_drill_bounds():
d = Drill((0, 0), 2, None)
xbounds, ybounds = d.bounding_box