Salome HOME
avoid code duplication, move common tests to tests.py
authormbs <martin.bernhard@opencascade.com>
Thu, 12 Jan 2023 14:45:00 +0000 (14:45 +0000)
committerGérald NICOLAS <gerald.nicolas@edf.fr>
Wed, 1 Feb 2023 16:32:07 +0000 (17:32 +0100)
12 files changed:
src/FeaturesPlugin/Test/TestBooleanCommon_Fuzzy.py
src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_1.py
src/FeaturesPlugin/Test/TestBooleanCut_Fuzzy_2.py
src/FeaturesPlugin/Test/TestBooleanFuse_Fuzzy.py
src/FeaturesPlugin/Test/TestGlueFaces_Compound.py
src/FeaturesPlugin/Test/TestGlueFaces_Faces.py
src/FeaturesPlugin/Test/TestGlueFaces_Shell.py
src/FeaturesPlugin/Test/TestGlueFaces_Solids.py
src/FeaturesPlugin/Test/TestSewing_Groups.py
src/FeaturesPlugin/Test/TestSewing_Manifold.py
src/FeaturesPlugin/Test/TestSewing_NonManifold.py
src/PythonAPI/model/tests/tests.py

index 9d01e2482caa4e2c57cf7db20a2a91041f3ed539..447cae546d43e87b7a193a36a49e19e0a660c424 100644 (file)
 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)
index d880a3280aa2b375f1e1df5e01269357b9638019..0d14f789390fa0981bfd10decb145af4496f8cd5 100644 (file)
 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])
index 61a26425a07e9917d4f41b1f10f7de0a91e844a9..6c59395a0149e29c4c0c2faa0a918b87b4f20336 100644 (file)
 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])
index 6a85356641006c6c6555332f2c45cd80487b4c2a..f7e0c1b1bfedf49a6c3e2dece5e72782f4965161 100644 (file)
 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])
index 47aa16fd3ac1df5aa437628fbebe3528f3d4c580..c1af6bb200882379b7478ef95c3e0198d52d9b28 100644 (file)
 #
 
 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
index d4b7131b5f97124d8b8014737165f494a3f3ddeb..49305e624d3760b72bf2ff54dbc9da2a97ed4660 100644 (file)
 #
 
 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])
index d9688acbd758264c468509485816c62af7bcb1ed..06fd662f36d25667e06791d0ff084f4aaa23d319 100644 (file)
 #
 
 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
index 424c0270d92dfdc29a78dd443a4fbcd157264e51..97eb0b95b61c5854810cda2b3a39674b4aed027d 100644 (file)
 #
 
 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
index 5536a53174dc20ba2aee412eac8ba412064b98ce..b2b8f0ca74825ab8f0e82eba2e0ab97816ad8cfd 100644 (file)
@@ -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)
index c73f522f27addcd9846e0360201cf4f5d1a9a86f..0c0a0a759053cdb4d8bf06125152cc8b4cd5c8cf 100644 (file)
 #
 
 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])
index d64ba8b09f5c86fd027b19573ce17ce62b83d4a4..76528498c4cfe05bb619db6d70c3a14f06905feb 100644 (file)
 #
 
 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])
index 79ac48d13ebedfa9aa899c33c5dcabcff3ffcf5f..924ad3405ba97f1f0d1b44b5b23b9ae3cf582c10 100644 (file)
@@ -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.