-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)
-