summaryrefslogtreecommitdiff
path: root/gerber/tests/test_primitives.py
diff options
context:
space:
mode:
Diffstat (limited to 'gerber/tests/test_primitives.py')
-rw-r--r--gerber/tests/test_primitives.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/gerber/tests/test_primitives.py b/gerber/tests/test_primitives.py
index c49b558..52d774c 100644
--- a/gerber/tests/test_primitives.py
+++ b/gerber/tests/test_primitives.py
@@ -13,17 +13,18 @@ def test_primitive_smoketest():
try:
p.bounding_box
assert_false(True, 'should have thrown the exception')
- except NotImplementedError:
+ except NotImplementedError:
pass
#assert_raises(NotImplementedError, p.bounding_box)
p.to_metric()
p.to_inch()
- try:
- p.offset(1, 1)
- assert_false(True, 'should have thrown the exception')
- except NotImplementedError:
- pass
+ #try:
+ # p.offset(1, 1)
+ # assert_false(True, 'should have thrown the exception')
+ #except NotImplementedError:
+ # pass
+
def test_line_angle():
@@ -291,7 +292,7 @@ def test_circle_conversion():
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
assert_equal(c.hole_diameter, None)
-
+
# Circle initially metric, with hole
c = Circle((2.54, 25.4), 254.0, 127.0, units='metric')
@@ -310,7 +311,7 @@ def test_circle_conversion():
assert_equal(c.position, (0.1, 1.))
assert_equal(c.diameter, 10.)
assert_equal(c.hole_diameter, 5.)
-
+
# Circle initially inch, no hole
c = Circle((0.1, 1.0), 10.0, units='inch')
# No effect
@@ -349,7 +350,6 @@ def test_circle_conversion():
assert_equal(c.hole_diameter, 127.)
-
def test_circle_offset():
c = Circle((0, 0), 1)
c.offset(1, 0)
@@ -437,13 +437,13 @@ def test_rectangle_ctor():
assert_equal(r.position, pos)
assert_equal(r.width, width)
assert_equal(r.height, height)
-
+
def test_rectangle_hole_radius():
""" Test rectangle hole diameter calculation
"""
r = Rectangle((0,0), 2, 2)
assert_equal(0, r.hole_radius)
-
+
r = Rectangle((0,0), 2, 2, 1)
assert_equal(0.5, r.hole_radius)
@@ -464,7 +464,7 @@ def test_rectangle_bounds():
def test_rectangle_conversion():
"""Test converting rectangles between units"""
-
+
# Initially metric no hole
r = Rectangle((2.54, 25.4), 254.0, 2540.0, units='metric')
@@ -482,7 +482,7 @@ def test_rectangle_conversion():
assert_equal(r.position, (0.1, 1.0))
assert_equal(r.width, 10.0)
assert_equal(r.height, 100.0)
-
+
# Initially metric with hole
r = Rectangle((2.54, 25.4), 254.0, 2540.0, 127.0, units='metric')
@@ -520,7 +520,7 @@ def test_rectangle_conversion():
assert_equal(r.position, (2.54, 25.4))
assert_equal(r.width, 254.0)
assert_equal(r.height, 2540.0)
-
+
# Initially inch with hole
r = Rectangle((0.1, 1.0), 10.0, 100.0, 5.0, units='inch')
r.to_inch()
@@ -887,7 +887,6 @@ def test_polygon_ctor():
assert_equal(p.hole_diameter, hole_diameter)
-
def test_polygon_bounds():
""" Test polygon bounding box calculation
"""
@@ -903,7 +902,7 @@ def test_polygon_bounds():
def test_polygon_conversion():
p = Polygon((2.54, 25.4), 3, 254.0, 0, units='metric')
-
+
# No effect
p.to_metric()
assert_equal(p.position, (2.54, 25.4))
@@ -1209,6 +1208,7 @@ def test_drill_ctor_validation():
assert_raises(TypeError, Drill, (3,4,5), 5, None)
+
def test_drill_bounds():
d = Drill((0, 0), 2, None)
xbounds, ybounds = d.bounding_box
@@ -1223,7 +1223,7 @@ def test_drill_bounds():
def test_drill_conversion():
d = Drill((2.54, 25.4), 254., None, units='metric')
- # No effect
+ #No effect
d.to_metric()
assert_equal(d.position, (2.54, 25.4))
assert_equal(d.diameter, 254.0)
@@ -1232,7 +1232,7 @@ def test_drill_conversion():
assert_equal(d.position, (0.1, 1.0))
assert_equal(d.diameter, 10.0)
- # No effect
+ #No effect
d.to_inch()
assert_equal(d.position, (0.1, 1.0))
assert_equal(d.diameter, 10.0)