diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6faf7a0f45245a8fc590d967884b6268d78c5928..d02549437f4d96092adea2dc0aa03dde6836fec9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,2 +1,2 @@ tests: - script: python -m unittest -v + script: python -m -v unittest discover tests diff --git a/AmpScan/trim.py b/AmpScan/trim.py index f48e659560bbcab21b29d032b7ae6f59cc7025ab..7bc61a2d9343cdfae17ee53b7001e7e9ff8f858b 100644 --- a/AmpScan/trim.py +++ b/AmpScan/trim.py @@ -31,7 +31,7 @@ class trimMixin(object): >>> amp.planarTrim(100, 2) """ - if isinstance(height, Number): + if isinstance(height, Number) and isinstance(plane, int): # planar values for each vert on face fv = self.vert[self.faces, plane] # Number points on each face are above cut plane diff --git a/tests/test_trim.py b/tests/test_trim.py index abf9f4a5814014a9f22014cd262888dbe84f9e42..74759cd65a7e3b38afe267dc2cd90e35b35c68da 100644 --- a/tests/test_trim.py +++ b/tests/test_trim.py @@ -17,6 +17,15 @@ class TestTrim(unittest.TestCase): def test_trim(self): """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): self.amp.planarTrim([], plane=[])