X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM_SWIG%2FGEOM_TestField.py;h=69a798c6bd5e918f8b2f724ab73d8bfdb849a665;hb=4b84d5ef39e8bc3247c4d4fa9e1fddfac2431254;hp=1200655def308f138b7358e4bae6e3fe4301d4c0;hpb=9680031be017f475ebb1d506a72b9527f5ce70b3;p=modules%2Fgeom.git diff --git a/src/GEOM_SWIG/GEOM_TestField.py b/src/GEOM_SWIG/GEOM_TestField.py index 1200655de..69a798c6b 100644 --- a/src/GEOM_SWIG/GEOM_TestField.py +++ b/src/GEOM_SWIG/GEOM_TestField.py @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -47,13 +47,13 @@ def CheckFieldCreation(shape, name, ftype, dimension, componentNames, nbFiOrMust # WARNING: assure name uniquness to check geompy.GetField( shape, name ) try: field = geompy.CreateField(shape, name, ftype, dimension, componentNames) - except Exception, e: + except Exception as e: if nbFiOrMustFail == MustFail: - print "Ok, expected exception caught: %s"%e + print("Ok, expected exception caught: %s"%e) return raise e if nbFiOrMustFail == MustFail: - raise RuntimeError, "Expected exception NOT thrown" + raise RuntimeError("Expected exception NOT thrown") assert field.getShape() assert field.getShape().IsSame( shape ) assert field.getName() == name @@ -70,13 +70,13 @@ def CheckFieldCreation(shape, name, ftype, dimension, componentNames, nbFiOrMust def CheckStepManips(field, step, stamp, values, nbStepsOrMustFail, toRemove=False): try: stp = field.addStep(step, stamp, values) - except Exception, e: + except Exception as e: if nbStepsOrMustFail == MustFail: - print "Ok, expected exception caught: %s"%e + print("Ok, expected exception caught: %s"%e) return raise e if nbStepsOrMustFail == MustFail: - raise RuntimeError, "Expected exception NOT thrown" + raise RuntimeError("Expected exception NOT thrown") assert field.countSteps() == nbStepsOrMustFail assert len( field.getSteps() ) == nbStepsOrMustFail assert step in field.getSteps() @@ -138,12 +138,12 @@ def TestField (geomBuilder, math): CheckStepManips( bfield, 2, -2, [1,0]*4, 1 ) # int field on 6 faces ifield = geompy.CreateField(shape, "intF", GEOM.FDT_Int, 2, ["id","domain"]) - CheckStepManips( ifield, -1, -10, range(12), 1 ) - CheckStepManips( ifield, -2, -20, range(6)*2, 2 ) + CheckStepManips( ifield, -1, -10, list(range(12)), 1 ) + CheckStepManips( ifield, -2, -20, list(range(6))*2, 2 ) # double field on a solid dfield = geompy.CreateField(shape, "dblS", GEOM.FDT_Double, 3, ["a","b","c"]) CheckStepManips( dfield, -1, -10, [-1.1, 2.3, 4000], 1 ) - CheckStepManips( dfield, -2, -20, range(3), 2 ) + CheckStepManips( dfield, -2, -20, list(range(3)), 2 ) # assert exception in case of invalid parameters CheckStepManips( sfield, -1, -10, ["25 Sep","2013"], MustFail ) # step already exists @@ -159,7 +159,7 @@ def TestField (geomBuilder, math): # dump the study import salome assert( salome.myStudy.DumpStudy(os.path.dirname(dumpFile), os.path.basename(dumpFile), 1, 0)) - execfile( pyFile ) + exec(compile(open( pyFile ).read(), pyFile, 'exec')) os.remove( pyFile ) - print "Field manipulations work OK" + print("Field manipulations work OK")