From 55b70c882cf02c987537d97a1a60dd1f9bbe256c Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Tue, 19 Aug 2014 08:10:46 -0400 Subject: [PATCH] Cleaned up a few of the assert statements and fixed the findall line in exporters.py based on a FutureWarning. --- cadquery/freecad_impl/exporters.py | 2 +- tests/TestImporters.py | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cadquery/freecad_impl/exporters.py b/cadquery/freecad_impl/exporters.py index 1b05ef1..5c09db8 100644 --- a/cadquery/freecad_impl/exporters.py +++ b/cadquery/freecad_impl/exporters.py @@ -239,7 +239,7 @@ def getPaths(freeCadSVG): #yuk, freecad returns svg fragments. stupid stupid fullDoc = "%s" % freeCadSVG e = ET.ElementTree(ET.fromstring(fullDoc)) - segments = e.findall("//g") + segments = e.findall(".//g") for s in segments: paths = s.findall("path") diff --git a/tests/TestImporters.py b/tests/TestImporters.py index cdb8d15..6cb8390 100644 --- a/tests/TestImporters.py +++ b/tests/TestImporters.py @@ -38,15 +38,10 @@ class TestImporters(BaseTest): #Check to make sure we got a solid back self.assertTrue(importedShape.val().ShapeType() == "Solid") - #Check the number of vertices per face to make sure we have a box shape - self.assertTrue(importedShape.faces("+X").vertices().size() == 4) - self.assertTrue(importedShape.faces("+Y").vertices().size() == 4) - self.assertTrue(importedShape.faces("+Z").vertices().size() == 4) - - #Check the faces per selection on an axis to make sure we have a box shape - self.assertTrue(importedShape.faces("+X").size() == 1) - self.assertTrue(importedShape.faces("+Y").size() == 1) - self.assertTrue(importedShape.faces("+Z").size() == 1) + #Check the number of faces and vertices per face to make sure we have a box shape + self.assertTrue(importedShape.faces("+X").size() == 1 and importedShape.faces("+X").vertices().size() == 4) + self.assertTrue(importedShape.faces("+Y").size() == 1 and importedShape.faces("+Y").vertices().size() == 4) + self.assertTrue(importedShape.faces("+Z").size() == 1 and importedShape.faces("+Z").vertices().size() == 4) def testSTEP(self): """