]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesPlugin/Test/TestSewing_NonManifold.py
Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / TestSewing_NonManifold.py
index d64ba8b09f5c86fd027b19573ce17ce62b83d4a4..d5aa39f61381ca00de5eb76374c342fdec530aa8 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2022  CEA/DEN, EDF R&D
+# Copyright (C) 2014-2023  CEA, EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 #
 
 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])