Skip to content
Snippets Groups Projects
Commit 74352164 authored by jack-parsons's avatar jack-parsons
Browse files

Adding more tests to trim method

parent 27f2646a
No related branches found
No related tags found
1 merge request!23Merge in Jack's changes
Pipeline #858 failed
tests: tests:
script: python -m unittest -v script: python -m -v unittest discover tests
...@@ -31,7 +31,7 @@ class trimMixin(object): ...@@ -31,7 +31,7 @@ class trimMixin(object):
>>> amp.planarTrim(100, 2) >>> amp.planarTrim(100, 2)
""" """
if isinstance(height, Number): if isinstance(height, Number) and isinstance(plane, int):
# planar values for each vert on face # planar values for each vert on face
fv = self.vert[self.faces, plane] fv = self.vert[self.faces, plane]
# Number points on each face are above cut plane # Number points on each face are above cut plane
......
...@@ -17,6 +17,15 @@ class TestTrim(unittest.TestCase): ...@@ -17,6 +17,15 @@ class TestTrim(unittest.TestCase):
def test_trim(self): def test_trim(self):
"""Tests the trim method of AmpObject""" """Tests the trim method of AmpObject"""
# Testing that the method runs
self.amp.planarTrim(0.6, plane=2)
# Testing invalid data types raise TypeErrors
with self.assertRaises(TypeError):
self.amp.planarTrim(0.6, plane=[])
with self.assertRaises(TypeError):
self.amp.planarTrim(0.6, plane=0.9)
with self.assertRaises(TypeError): with self.assertRaises(TypeError):
self.amp.planarTrim([], plane=[]) self.amp.planarTrim([], plane=[])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment