Salome HOME
[Code coverage GeomAlgoAPI]: Cover error messages in transformations
authorazv <azv@opencascade.com>
Thu, 20 Dec 2018 03:48:00 +0000 (06:48 +0300)
committerazv <azv@opencascade.com>
Thu, 20 Dec 2018 04:23:34 +0000 (07:23 +0300)
test.API/SHAPER/Transformations/TestAPI_Rotation.py
test.API/SHAPER/Transformations/TestAPI_Scale.py
test.API/SHAPER/Transformations/TestAPI_Symmetry.py
test.API/SHAPER/Transformations/TestAPI_Translation.py

index 1e9323572fd0799746e25dc9cfef4d4e45913cd1..ece048f23261f6f1c758cb7056e68c767a15b465 100644 (file)
@@ -21,6 +21,7 @@
 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
 from GeomAPI import GeomAPI_Ax1 as axis, GeomAPI_Pnt as pnt, GeomAPI_Dir as direction
+from GeomAPI import GeomAPI_Shape as shape
 
 # Create Boxes
 Box_1 = shaperpy.makeBox(10.,10.,10.)
@@ -113,3 +114,8 @@ try:
     Rotation_17 = shaperpy.makeRotation(None, pntOrigin, pnt3, pnt2)
 except myExcept as ec:
     assert(ec.what() == "Rotation builder :: source shape is not valid.")
+
+try:
+    Rotation_18 = shaperpy.makeRotation(shape(), ax1, 450)
+except myExcept as ec:
+    assert(ec.what() == "Rotation builder :: source shape does not contain any actual shape.")
index 8fc2c52449a0f10ecb08347570a6b6a16dd6e095..dccc3573de46c8b70e24b63f2fd65ec224b6938d 100644 (file)
@@ -20,7 +20,7 @@
 
 from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
 from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
-from GeomAPI import GeomAPI_Pnt as pnt
+from GeomAPI import GeomAPI_Pnt as pnt, GeomAPI_Shape as shape
 
 # Create Boxes
 Box_1 = shaperpy.makeBox(10.,10.,10.)
@@ -77,4 +77,19 @@ Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5)
 try :
     Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.)
 except myExcept as ec :
-    assert(ec.what() == "Scale builder :: center point is not valid.")
\ No newline at end of file
+    assert(ec.what() == "Scale builder :: center point is not valid.")
+
+try :
+    Scale_19 = shaperpy.makeScale(None, pntOrigin, 2., 3., 1.)
+except myExcept as ec :
+    assert(ec.what() == "Scale builder :: source shape is not valid.")
+
+try :
+    Scale_20 = shaperpy.makeScale(shape(), pntOrigin, 2.)
+except myExcept as ec :
+    assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.")
+
+try :
+    Scale_21 = shaperpy.makeScale(shape(), pntOrigin, 2., 3., 1.)
+except myExcept as ec :
+    assert(ec.what() == "Scale builder :: source shape does not contain any actual shape.")
index 6356d227ff47461a8aea6fbcc464029a9b1c04d7..b264aec3ea6b3bbe75265f96a85d1e27e630eb96 100644 (file)
@@ -24,6 +24,7 @@ from GeomAPI import GeomAPI_Pnt as pnt
 from GeomAPI import GeomAPI_Dir as direction
 from GeomAPI import GeomAPI_Ax1 as axis
 from GeomAPI import GeomAPI_Ax2 as plane
+from GeomAPI import GeomAPI_Shape as shape
 
 # Create boxes
 Box_1 = shaperpy.makeBox(10., 10., 10.)
@@ -63,10 +64,30 @@ Symmetry_1 = shaperpy.makeSymmetry(Box_1, origin)
 Symmetry_2 = shaperpy.makeSymmetry(Box_2, pnt1)
 
 try :
-    Symmetry_6 = shaperpy.makeSymmetry(Box_2, None)
+    Symmetry_3 = shaperpy.makeSymmetry(Box_3, None)
 except myExcept as ec :
     assert(ec.what() == "Symmetry builder :: point is not valid.")
 
-Symmetry_7 = shaperpy.makeSymmetry(Box_7, axZ)
-Symmetry_8 = shaperpy.makeSymmetry(Box_8, ax1)
-Symmetry_13 = shaperpy.makeSymmetry(Box_13, planeXOY)
+Symmetry_4 = shaperpy.makeSymmetry(Box_4, axZ)
+Symmetry_5 = shaperpy.makeSymmetry(Box_5, ax1)
+Symmetry_6 = shaperpy.makeSymmetry(Box_6, planeXOY)
+
+try :
+    Symmetry_7 = shaperpy.makeSymmetry(None, pnt1)
+except myExcept as ec :
+    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+
+try :
+    Symmetry_8 = shaperpy.makeSymmetry(None, axZ)
+except myExcept as ec :
+    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+
+try :
+    Symmetry_9 = shaperpy.makeSymmetry(None, planeXOY)
+except myExcept as ec :
+    assert(ec.what() == "Symmetry builder :: source shape is not valid.")
+
+try :
+    Symmetry_10 = shaperpy.makeSymmetry(shape(), pnt1)
+except myExcept as ec :
+    assert(ec.what() == "Symmetry builder :: source shape does not contain any actual shape.")
index 1d6a18c1f987085a7dcd2ada52a7b7191c78dbd8..1297ee7d236194cd2bad76785a9563ca278bd737 100644 (file)
@@ -23,6 +23,7 @@ from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
 from GeomAPI import GeomAPI_Ax1 as axis
 from GeomAPI import GeomAPI_Pnt as pnt
 from GeomAPI import GeomAPI_Dir as direction
+from GeomAPI import GeomAPI_Shape as shape
 
 # Points
 pntOrigin = pnt(0.,0.,0.)
@@ -72,49 +73,69 @@ try:
 except myExcept as ec:
     assert(ec.what() == "Translation builder :: axis is not valid.")
 
-Translation_9 = shaperpy.makeTranslation(Box_5, ax4, 15.)
+Translation_5 = shaperpy.makeTranslation(Box_5, ax4, 15.)
 
 MultiTranslation_1 = shaperpy.makeMultiTranslation(Box_6, ax1, 15., 3, ax2, 15., 3)
-Translation_10 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.)
+Translation_6 = shaperpy.makeTranslation(MultiTranslation_1, ax3, 15.)
 
 MultiTranslation_2 = shaperpy.makeMultiTranslation(Box_7, ax1, 15., 3, ax2, 15., 3)
-Translation_11 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.)
+Translation_7 = shaperpy.makeTranslation(MultiTranslation_2, ax3, 0.)
 
 MultiTranslation_3 = shaperpy.makeMultiTranslation(Box_8, ax1, 15., 3, ax2, 15., 3)
-Translation_12 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.)
+Translation_8 = shaperpy.makeTranslation(MultiTranslation_3, ax3, -15.)
 
 MultiTranslation_4 = shaperpy.makeMultiTranslation(Box_9, ax1, 15., 3, ax2, 15., 3)
 try:
-    Translation_13 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.)
+    Translation_9 = shaperpy.makeTranslation(MultiTranslation_4, None, 15.)
 except myExcept as ec:
     assert(ec.what() == "Translation builder :: axis is not valid.")
 
 MultiTranslation_5 = shaperpy.makeMultiTranslation(Box_10, ax1, 15., 3, ax2, 15., 3)
-Translation_18 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.)
+Translation_10 = shaperpy.makeTranslation(MultiTranslation_5, ax4, 15.)
 
 # Translations "By dimensions in X, in Y and in Z"
-Translation_91 = shaperpy.makeTranslation(Box_11, 10., 20., 15.)
-Translation_92 = shaperpy.makeTranslation(Box_11, 0., 20., 15.)
-Translation_93 = shaperpy.makeTranslation(Box_11, 10., 0., 15.)
-Translation_94 = shaperpy.makeTranslation(Box_11, 10., 20., 0.)
-Translation_95 = shaperpy.makeTranslation(Box_11, -10., 20., 15.)
-Translation_96 = shaperpy.makeTranslation(Box_11, 10., -20., 15.)
-Translation_97 = shaperpy.makeTranslation(Box_11, 10., 20., -15.)
+Translation_11 = shaperpy.makeTranslation(Box_11, 10., 20., 15.)
+Translation_12 = shaperpy.makeTranslation(Box_11, 0., 20., 15.)
+Translation_13 = shaperpy.makeTranslation(Box_11, 10., 0., 15.)
+Translation_14 = shaperpy.makeTranslation(Box_11, 10., 20., 0.)
+Translation_15 = shaperpy.makeTranslation(Box_11, -10., 20., 15.)
+Translation_16 = shaperpy.makeTranslation(Box_11, 10., -20., 15.)
+Translation_17 = shaperpy.makeTranslation(Box_11, 10., 20., -15.)
 
 # Translations "By two points"
-Translation_99 = shaperpy.makeTranslation(Box_11, pnt1, pnt2)
+Translation_18 = shaperpy.makeTranslation(Box_11, pnt1, pnt2)
 
 try:
-    Translation_100 = shaperpy.makeTranslation(Box_11, pnt1, pnt1)
+    Translation_19 = shaperpy.makeTranslation(Box_11, pnt1, pnt1)
 except myExcept as ec:
     assert(ec.what() == "Translation builder :: start point and end point coincide.")
 
 try:
-    Translation_101 = shaperpy.makeTranslation(Box_11, None, pnt1)
+    Translation_20 = shaperpy.makeTranslation(Box_11, None, pnt1)
 except myExcept as ec:
     assert(ec.what() == "Translation builder :: start point is not valid.")
 
 try:
-    Translation_102 = shaperpy.makeTranslation(Box_11, pnt1, None)
+    Translation_21 = shaperpy.makeTranslation(Box_11, pnt1, None)
 except myExcept as ec:
-    assert(ec.what() == "Translation builder :: end point is not valid.")
\ No newline at end of file
+    assert(ec.what() == "Translation builder :: end point is not valid.")
+
+try:
+    Translation_22 = shaperpy.makeTranslation(None, ax1, 15.)
+except myExcept as ec:
+    assert(ec.what() == "Translation builder :: source shape is not valid.")
+
+try:
+    Translation_23 = shaperpy.makeTranslation(None, 10., 20., 15.)
+except myExcept as ec:
+    assert(ec.what() == "Translation builder :: source shape is not valid.")
+
+try:
+    Translation_24 = shaperpy.makeTranslation(None, pnt1, pnt2)
+except myExcept as ec:
+    assert(ec.what() == "Translation builder :: source shape is invalid.")
+
+try:
+    Translation_25 = shaperpy.makeTranslation(shape(), ax1, 15.)
+except myExcept as ec:
+    assert(ec.what() == "Translation builder :: source shape does not contain any actual shape.")