From: mbs Date: Thu, 12 Jan 2023 14:45:00 +0000 (+0000) Subject: avoid code duplication, move common tests to tests.py X-Git-Tag: V9_12_0a1~16^2~32^2~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4fd44a9e0c3bb0161eb48b91d801f36bb9f52644;p=modules%2Fshaper.git avoid code duplication, move common tests to tests.py --- diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py b/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py index 9d01e2482..447cae546 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py +++ b/src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py @@ -20,28 +20,6 @@ from salome.shaper import model from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - model.begin() partSet = model.moduleDocument() @@ -64,10 +42,10 @@ model.do() model.testNbResults(Common_1, 1) model.testNbSubResults(Common_1, [0]) -testNbUniqueSubShapes(Common_1, GeomAPI_Shape.SOLID, [1]) -testNbUniqueSubShapes(Common_1, GeomAPI_Shape.FACE, [3]) -testNbUniqueSubShapes(Common_1, GeomAPI_Shape.EDGE, [3]) -testNbUniqueSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) +model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.SOLID, [1]) +model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.FACE, [3]) +model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.EDGE, [3]) +model.testNbUniqueSubShapes(Common_1, GeomAPI_Shape.VERTEX, [2]) ### Set a higher fuzzy value Param_fuzzy.setValue(1.e-5) diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py index d880a3280..0d14f7893 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py @@ -20,28 +20,6 @@ from salome.shaper import model from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - model.begin() partSet = model.moduleDocument() @@ -68,10 +46,10 @@ model.do() model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.SOLID, [1]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [14]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [24]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.SOLID, [1]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [14]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Cut_1, [49.093623770546]) ### Set a higher fuzzy value @@ -82,8 +60,8 @@ model.end() model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [4]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.SOLID, [4]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [20]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [24]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.SOLID, [4]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [20]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [36]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [24]) model.testResultsVolumes(Cut_1, [49.088834629314]) diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py index 61a26425a..6c59395a0 100644 --- a/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py +++ b/src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py @@ -20,28 +20,6 @@ from salome.shaper import model from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - model.begin() partSet = model.moduleDocument() @@ -115,9 +93,9 @@ model.do() model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [6]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [6]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [6]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [6]) ### Set a higher fuzzy value Param_fuzzy.setValue(1.e-4) @@ -127,6 +105,6 @@ model.end() model.testNbResults(Cut_1, 1) model.testNbSubResults(Cut_1, [0]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [4]) -testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [4]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.FACE, [1]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.EDGE, [4]) +model.testNbUniqueSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [4]) diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py b/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py index 6a8535664..f7e0c1b1b 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py +++ b/src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py @@ -20,28 +20,6 @@ from salome.shaper import model from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - model.begin() partSet = model.moduleDocument() @@ -64,10 +42,10 @@ model.do() model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [24]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [15]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.FACE, [11]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [24]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [15]) model.testResultsVolumes(Fuse_1, [2000.02000010]) ### Set a higher fuzzy value @@ -78,8 +56,8 @@ model.end() model.testNbResults(Fuse_1, 1) model.testNbSubResults(Fuse_1, [0]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.FACE, [10]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [20]) -testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [12]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.FACE, [10]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [20]) +model.testNbUniqueSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [12]) model.testResultsVolumes(Fuse_1, [2000.02166677]) diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py b/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py index 47aa16fd3..c1af6bb20 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Compound.py @@ -18,42 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape - -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testCompound(theFeature,theModel,NbSubRes,NbSolid,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in compound result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + # Create document model.begin() @@ -78,7 +43,7 @@ GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compo model.end() # gluing successful -testCompound(GlueFaces_1, model, [2], [2], [11], [20], [12]) +model.testCompound(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 solids with 1 common edge only @@ -92,7 +57,7 @@ GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compo model.end() # no faces glued -testCompound(GlueFaces_2, model, [2], [2], [12], [23], [14]) +model.testCompound(GlueFaces_2, [2], [2], [12], [23], [14]) # ============================================================================= # Test 3. Glue faces for 2 solids with 2 adjacent faces above default tolerance @@ -108,7 +73,7 @@ GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compo model.end() # no faces glued -testCompound(GlueFaces_3, model, [2], [2], [12], [24], [16]) +model.testCompound(GlueFaces_3, [2], [2], [12], [24], [16]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance @@ -121,7 +86,7 @@ GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("COMPOUND", "Compo model.end() # gluing successful -testCompound(GlueFaces_4, model, [2], [2], [11], [20], [12]) +model.testCompound(GlueFaces_4, [2], [2], [11], [20], [12]) # ============================================================================= # Test 5. Check Python dump diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py b/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py index d4b7131b5..49305e624 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Faces.py @@ -18,42 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testCompound(theFeature,theModel,NbSubRes,NbSolid,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in compound result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) # Create document model.begin() @@ -83,7 +48,7 @@ GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Translat model.do() # gluing successful -testCompound(GlueFaces_1, model, [2], [2], [11], [20], [12]) +model.testCompound(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 faces with 1 common edge only @@ -95,7 +60,7 @@ GlueFaces_2.result().subResult(1).setName("GlueFaces_2_1_2") model.do() # gluing successful -testCompound(GlueFaces_2, model, [2], [0], [2], [7], [6]) +model.testCompound(GlueFaces_2, [2], [0], [2], [7], [6]) # ============================================================================= # Test 3. Glue faces for 1 solid and 1 faces with 1 common edge @@ -108,4 +73,4 @@ GlueFaces_3.result().subResult(1).setName("GlueFaces_3_1_2") model.end() # no faces glued -testCompound(GlueFaces_3, model, [2], [1], [7], [15], [10]) +model.testCompound(GlueFaces_3, [2], [1], [7], [15], [10]) diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py b/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py index d9688acbd..06fd662f3 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Shell.py @@ -18,42 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape - -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testCompound(theFeature,theModel,NbSubRes,NbSolid,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in compound result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + # Create document model.begin() @@ -80,7 +45,7 @@ GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_ model.end() # gluing successful -testCompound(GlueFaces_1, model, [2], [0], [3], [10], [8]) +model.testCompound(GlueFaces_1, [2], [0], [3], [10], [8]) # ============================================================================= # Test 2. Glue faces for 2 shells with 1 common edge only @@ -94,7 +59,7 @@ GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_ model.end() # gluing successful -testCompound(GlueFaces_2, model, [2], [0], [4], [13], [10]) +model.testCompound(GlueFaces_2, [2], [0], [4], [13], [10]) # ============================================================================= # Test 3. Glue faces for 2 shells with 2 adjacent faces above default tolerance @@ -110,7 +75,7 @@ GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_ model.end() # no faces glued -testCompound(GlueFaces_3, model, [2], [0], [4], [14], [12]) +model.testCompound(GlueFaces_3, [2], [0], [4], [14], [12]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance @@ -123,7 +88,7 @@ GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("SHELL", "Shell_1_ model.end() # gluing successful -testCompound(GlueFaces_4, model, [2], [0], [3], [10], [8]) +model.testCompound(GlueFaces_4, [2], [0], [3], [10], [8]) # ============================================================================= # Test 5. Check Python dump diff --git a/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py b/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py index 424c0270d..97eb0b95b 100644 --- a/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py +++ b/src/FeaturesPlugin/Test/TestGlueFaces_Solids.py @@ -18,42 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape - -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testCompound(theFeature,theModel,NbSubRes,NbSolid,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in compound result - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) - assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + # Create document model.begin() @@ -76,7 +41,7 @@ GlueFaces_1 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1" model.end() # gluing successful -testCompound(GlueFaces_1, model, [2], [2], [11], [20], [12]) +model.testCompound(GlueFaces_1, [2], [2], [11], [20], [12]) # ============================================================================= # Test 2. Glue faces for 2 solids with 1 common edge only @@ -90,7 +55,7 @@ GlueFaces_2 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1" model.end() # gluing successful -testCompound(GlueFaces_2, model, [2], [2], [12], [23], [14]) +model.testCompound(GlueFaces_2, [2], [2], [12], [23], [14]) # ============================================================================= # Test 3. Glue faces for 2 solids with 2 adjacent faces above default tolerance @@ -106,7 +71,7 @@ GlueFaces_3 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1" model.end() # no faces glued -testCompound(GlueFaces_3, model, [2], [2], [12], [24], [16]) +model.testCompound(GlueFaces_3, [2], [2], [12], [24], [16]) # ============================================================================= # Test 4. Glue faces for 2 solids with 2 adjacent faces using different tolerance @@ -119,7 +84,7 @@ GlueFaces_4 = model.addGlueFaces(Part_1_doc, [model.selection("SOLID", "Box_1_1" model.end() # gluing successful -testCompound(GlueFaces_4, model, [2], [2], [11], [20], [12]) +model.testCompound(GlueFaces_4, [2], [2], [11], [20], [12]) # ============================================================================= # Test 5. Check Python dump diff --git a/src/FeaturesPlugin/Test/TestSewing_Groups.py b/src/FeaturesPlugin/Test/TestSewing_Groups.py index 5536a5317..b2b8f0ca7 100644 --- a/src/FeaturesPlugin/Test/TestSewing_Groups.py +++ b/src/FeaturesPlugin/Test/TestSewing_Groups.py @@ -8,40 +8,6 @@ from GeomAPI import GeomAPI_Shape from salome.shaper import model -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testResults(theFeature,theModel,NbRes,NbSubRes,NbShell,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in the results - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == NbRes), "Number of results: {} not equal to {}}.".format(aNbResults, NbRes) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) - model.begin() partSet = model.moduleDocument() @@ -149,13 +115,17 @@ model.testNbSubShapes(Group_2, GeomAPI_Shape.EDGE, [4]) Sewing_1 = model.addSewing(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], 0.0001, allowNonManifold = True, alwaysCreateResult = False) model.do() -testResults(Sewing_1, model, 1, [0], [1], [2], [7], [6]) +model.testResults(Sewing_1, 1, [0], [1], [2], [7], [6]) # Move the groups after Sewing (move to the end) Part_1_doc.moveFeature(Group_1.feature(), Sewing_1.feature()) Part_1_doc.moveFeature(Group_2.feature(), Sewing_1.feature()) model.end() +print("-------------------------------------------------------------------------") +print("IMPORTANT NOTE:") +print("The following checks will fail, as long as bos #33216 does not get fixed!") +print("-------------------------------------------------------------------------") model.testNbResults(Group_1, 1) model.testNbSubShapes(Group_1, GeomAPI_Shape.EDGE, [4]) model.testNbResults(Group_2, 1) @@ -172,7 +142,7 @@ model.begin() Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")]) model.do() -testResults(Shell_1, model, 2, [0,0], [1,1], [1,1], [4,4], [4,4]) +model.testResults(Shell_1, 2, [0,0], [1,1], [1,1], [4,4], [4,4]) model.testNbSubShapes(Shell_1, GeomAPI_Shape.EDGE, [4,4]) # Move the groups after Shell (move to the end) diff --git a/src/FeaturesPlugin/Test/TestSewing_Manifold.py b/src/FeaturesPlugin/Test/TestSewing_Manifold.py index c73f522f2..0c0a0a759 100644 --- a/src/FeaturesPlugin/Test/TestSewing_Manifold.py +++ b/src/FeaturesPlugin/Test/TestSewing_Manifold.py @@ -18,41 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape - -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testResults(theFeature,theModel,NbRes,NbSubRes,NbShell,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in the results - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == NbRes), "Number of results: {} not equal to {}}.".format(aNbResults, NbRes) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + # Create document model.begin() @@ -89,7 +55,7 @@ Sewing_1a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_1a, model, 1, [0], [1], [10], [23], [14]) +model.testResults(Sewing_1a, 1, [0], [1], [10], [23], [14]) # ============================================================================= # Test 1b. Sew two shells with a single common edge (do not create result) @@ -101,7 +67,7 @@ Sewing_1b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_1b, model, 1, [0], [1], [10], [23], [14]) +model.testResults(Sewing_1b, 1, [0], [1], [10], [23], [14]) # ============================================================================= # Test 2a. Sew two shells with four common edges (create result) @@ -115,7 +81,7 @@ Sewing_2a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_2a, model, 1, [0], [1], [10], [20], [12]) +model.testResults(Sewing_2a, 1, [0], [1], [10], [20], [12]) # ============================================================================= # Test 2b. Sew two shells with four common edges (do not create result) @@ -127,7 +93,7 @@ Sewing_2b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_2b, model, 1, [0], [1], [10], [20], [12]) +model.testResults(Sewing_2b, 1, [0], [1], [10], [20], [12]) # ============================================================================= # Test 3a. Sew two slightly disconnected shells (create result) @@ -141,7 +107,7 @@ Sewing_3a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # no sewing done (result is a compound with the two input shells) -testResults(Sewing_3a, model, 1, [2], [2], [10], [24], [16]) +model.testResults(Sewing_3a, 1, [2], [2], [10], [24], [16]) # ============================================================================= # Test 3b. Sew two slightly disconnected shells (do not create result) @@ -167,7 +133,7 @@ Sewing_4a = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_4a, model, 1, [0], [1], [10], [20], [12]) +model.testResults(Sewing_4a, 1, [0], [1], [10], [20], [12]) # ============================================================================= # Test 4b. Sew two slightly disconnected shells with larger tolerance (do not create result) @@ -179,4 +145,4 @@ Sewing_4b = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.end() # sewing successful -testResults(Sewing_4b, model, 1, [0], [1], [10], [20], [12]) +model.testResults(Sewing_4b, 1, [0], [1], [10], [20], [12]) diff --git a/src/FeaturesPlugin/Test/TestSewing_NonManifold.py b/src/FeaturesPlugin/Test/TestSewing_NonManifold.py index d64ba8b09..76528498c 100644 --- a/src/FeaturesPlugin/Test/TestSewing_NonManifold.py +++ b/src/FeaturesPlugin/Test/TestSewing_NonManifold.py @@ -18,41 +18,7 @@ # from salome.shaper import model -from GeomAPI import GeomAPI_Shape -aShapeTypes = { - GeomAPI_Shape.SOLID: "GeomAPI_Shape.SOLID", - GeomAPI_Shape.FACE: "GeomAPI_Shape.FACE", - GeomAPI_Shape.EDGE: "GeomAPI_Shape.EDGE", - GeomAPI_Shape.VERTEX: "GeomAPI_Shape.VERTEX"} - -def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): - """ Tests number of unique feature sub-shapes of passed type for each result. - :param theFeature: feature to test. - :param theShapeType: shape type of sub-shapes to test. - :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - aListSize = len(theExpectedNbSubShapes) - assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) - for anIndex in range(0, aNbResults): - aNbResultSubShapes = 0 - anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] - aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() - assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) - -def testResults(theFeature,theModel,NbRes,NbSubRes,NbShell,NbFace,NbEdge,NbVertex): - """ Tests numbers of unique sub-shapes in the results - """ - aResults = theFeature.feature().results() - aNbResults = len(aResults) - assert (aNbResults == NbRes), "Number of results: {} not equal to {}}.".format(aNbResults, NbRes) - theModel.testNbSubResults(theFeature, NbSubRes) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) - testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) # Create document model.begin() @@ -82,7 +48,7 @@ Sewing_1 = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), m model.end() # sewing failed (result is a compound with the two input shells) -testResults(Sewing_1, model, 1, [2], [2], [4], [14], [12]) +model.testResults(Sewing_1, 1, [2], [2], [4], [14], [12]) # ============================================================================= # Test 2. Sew the same two shells allowing non-manifold results @@ -94,4 +60,4 @@ Sewing_2 = model.addSewing(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), m model.end() # sewing successful -testResults(Sewing_2, model, 1, [0], [1], [4], [13], [10]) +model.testResults(Sewing_2, 1, [0], [1], [4], [13], [10]) diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py index 79ac48d13..924ad3405 100644 --- a/src/PythonAPI/model/tests/tests.py +++ b/src/PythonAPI/model/tests/tests.py @@ -123,6 +123,50 @@ def testNbSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) +def testNbUniqueSubShapes(theFeature, theShapeType, theExpectedNbSubShapes): + """ Tests number of unique feature sub-shapes of passed type for each result. + :param theFeature: feature to test. + :param theShapeType: shape type of sub-shapes to test. + :param theExpectedNbSubShapes: list of sub-shapes numbers. Size of list should be equal to len(theFeature.results()). + """ + aResults = theFeature.feature().results() + aNbResults = len(aResults) + aListSize = len(theExpectedNbSubShapes) + assert (aNbResults == aListSize), "Number of results: {} not equal to list size: {}.".format(aNbResults, aListSize) + for anIndex in range(0, aNbResults): + aNbResultSubShapes = 0 + anExpectedNbSubShapes = theExpectedNbSubShapes[anIndex] + aNbResultSubShapes = aResults[anIndex].shape().subShapes(theShapeType, True).size() + assert (aNbResultSubShapes == anExpectedNbSubShapes), "Number of sub-shapes of type {} for result[{}]: {}. Expected: {}.".format(aShapeTypes[theShapeType], anIndex, aNbResultSubShapes, anExpectedNbSubShapes) + + +def testCompound(theFeature, NbSubRes, NbSolid, NbFace, NbEdge, NbVertex): + """ Tests number of unique sub-shapes in compound result + """ + aResults = theFeature.feature().results() + aNbResults = len(aResults) + assert (aNbResults == 1), "Number of results: {} not equal to 1.".format(aNbResults) + assert aResults[0].shape().isCompound(), "Result shape type: {}. Expected: COMPOUND.".format(aResults[0].shape().shapeTypeStr()) + testNbSubResults(theFeature, NbSubRes) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SOLID, NbSolid) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + + +def testResults(theFeature, NbRes, NbSubRes, NbShell, NbFace, NbEdge, NbVertex): + """ Tests numbers of unique sub-shapes in the results + """ + aResults = theFeature.feature().results() + aNbResults = len(aResults) + assert (aNbResults == NbRes), "Number of results: {} not equal to {}}.".format(aNbResults, NbRes) + testNbSubResults(theFeature, NbSubRes) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.SHELL, NbShell) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.FACE, NbFace) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.EDGE, NbEdge) + testNbUniqueSubShapes(theFeature, GeomAPI_Shape.VERTEX, NbVertex) + + def testResultsVolumes(theFeature, theExpectedResultsVolumes, theNbSignificantDigits = 7): """ Tests results volumes. :param theFeature: feature to test.