Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / TestBooleanCut_Fuzzy_2.py
index 61a26425a07e9917d4f41b1f10f7de0a91e844a9..7dba4586786399b62a0ee9edd8f937a5bb96f448 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2022  CEA/DEN, EDF R&D
+# Copyright (C) 2014-2023  CEA/DEN, EDF R&D
 #
 # 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)
-
 
 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])