X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test.API%2FSHAPER%2FTransformations%2FTestAPI_Scale.py;h=4538f9304d7635484f66319feefac1fa4df34463;hb=6028a6927ecea5cc5bcb81bc4cd86938a5b72040;hp=2904d5bd48d8330a4dd4906d03b572449a637c99;hpb=2f9cc8a307aeb75f6ee8c2c5c97f90acd5f3d53e;p=modules%2Fshaper.git diff --git a/test.API/SHAPER/Transformations/TestAPI_Scale.py b/test.API/SHAPER/Transformations/TestAPI_Scale.py index 2904d5bd4..4538f9304 100644 --- a/test.API/SHAPER/Transformations/TestAPI_Scale.py +++ b/test.API/SHAPER/Transformations/TestAPI_Scale.py @@ -1,26 +1,25 @@ -## Copyright (C) 2014-2017 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 -## License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Lesser General Public License for more details. -## -## You should have received a copy of the GNU Lesser General Public -## License along with this library; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -## -## See http:##www.salome-platform.org/ or -## email : webmaster.salome@opencascade.com -## +# Copyright (C) 2014-2024 CEA, EDF +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# 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.) @@ -46,14 +45,14 @@ Scale_1 = shaperpy.makeScale(Box_1, pntOrigin, 2.) Scale_2 = shaperpy.makeScale(Box_2, pnt1, 2.) try : Scale_6 = shaperpy.makeScale(Box_3, pntOrigin, 0) -except myExcept,ec : +except myExcept as ec : assert(ec.what() == "Scale builder :: the scale factor is null.") Scale_7 = shaperpy.makeScale(Box_4, pntOrigin, -3.) try : Scale_8 = shaperpy.makeScale(Box_5, None, 2.) -except myExcept,ec : +except myExcept as ec : assert(ec.what() == "Scale builder :: center point is not valid.") Scale_9 = shaperpy.makeScale(Box_6, pntOrigin, 2., 3., 1.) @@ -61,20 +60,35 @@ Scale_10 = shaperpy.makeScale(Box_7, pnt1, 2., 3., 1.) try : Scale_14 = shaperpy.makeScale(Box_8, pntOrigin, 0., 3., 1.) -except myExcept,ec : +except myExcept as ec : assert(ec.what() == "Scale builder :: the scale factor in X is null.") try : Scale_15 = shaperpy.makeScale(Box_9, pntOrigin, 2., 0., 1.) -except myExcept,ec : +except myExcept as ec : assert(ec.what() == "Scale builder :: the scale factor in Y is null.") try : Scale_16 = shaperpy.makeScale(Box_10, pntOrigin, 2., 3., 0.) -except myExcept,ec : +except myExcept as ec : assert(ec.what() == "Scale builder :: the scale factor in Z is null.") Scale_17 = shaperpy.makeScale(Box_11, pntOrigin, -2., -3., 0.5) try : Scale_18 = shaperpy.makeScale(Box_12, None, 2., 3., 1.) -except myExcept,ec : - assert(ec.what() == "Scale builder :: center point is not valid.") \ No newline at end of file +except myExcept as ec : + 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() == "Transformation :: 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.")