From: NATHALIE GORE Date: Thu, 28 Jun 2018 09:30:28 +0000 (+0200) Subject: Update tests for python 3 + remove study X-Git-Tag: SHAPER_V9_1_0RC1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=27816a2a70d129003c824377afc3565ab84aa8b5;p=plugins%2Fhybridplugin.git Update tests for python 3 + remove study --- diff --git a/tests/advanced_text_option.py b/tests/advanced_text_option.py index 357bd4e..8d1db4b 100644 --- a/tests/advanced_text_option.py +++ b/tests/advanced_text_option.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -16,7 +15,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() # first cylinder r1 = 0.5 @@ -73,7 +72,7 @@ geompy.addToStudyInFather( piquage, corner, 'corner' ) import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() Mesh_with_imprinting_set_by_groups = smesh.Mesh(piquage) NETGEN_2D_1 = Mesh_with_imprinting_set_by_groups.Triangle(algo=smeshBuilder.NETGEN_1D2D) @@ -105,7 +104,7 @@ if not isDone: Nb_elems_0 = Mesh_with_imprinting_set_by_groups.NbVolumes() -print "Nb_elems_0: ", Nb_elems_0 +print("Nb_elems_0: ", Nb_elems_0) Inlet_x_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Inlet_x,'Inlet_x',SMESH.FACE) Inlet_z_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Inlet_z,'Inlet_z',SMESH.FACE) @@ -121,10 +120,8 @@ if not isDone: Nb_elems_1 = Mesh_with_imprinting_set_by_groups.NbVolumes() -print "Nb_elems_1: ", Nb_elems_1 +print("Nb_elems_1: ", Nb_elems_1) # Check that the number of elements is changed by the option assert Nb_elems_1> 1.5*Nb_elems_0, "Advanced option as text does not work" -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) diff --git a/tests/cartesian_core_size.py b/tests/cartesian_core_size.py index c767dd7..8ff9900 100644 --- a/tests/cartesian_core_size.py +++ b/tests/cartesian_core_size.py @@ -5,7 +5,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -17,7 +16,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) OX = geompy.MakeVectorDXDYDZ(1, 0, 0) @@ -39,7 +38,7 @@ from salome.smesh import smeshBuilder from salome.HYBRIDPlugin import HYBRIDPluginBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() # Hybrid mesh with hexa dominant core # =================================== @@ -103,5 +102,3 @@ nb_hexas_3 = Mesh_3.NbHexas() # check that more hexaedra have been genereted assert nb_hexas_3 > nb_hexas_2 -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True) diff --git a/tests/enforced_mesh.py b/tests/enforced_mesh.py index 97d4871..6937631 100644 --- a/tests/enforced_mesh.py +++ b/tests/enforced_mesh.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -16,7 +15,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() # first cylinder r1 = 0.5 @@ -83,7 +82,7 @@ from salome.smesh import smeshBuilder from salome.StdMeshers import StdMeshersBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() Mesh_faces = smesh.Mesh(face) Mesh_faces.Triangle(algo=smeshBuilder.MG_CADSurf) @@ -182,5 +181,3 @@ assert len(Mesh_3.GetGroups()) == 1 assert Mesh_3.GetGroups()[0].GetName() == 'LayersGroup' assert Mesh_3.GetGroups()[0].Size() > 0 -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) diff --git a/tests/layers_imprinting.py b/tests/layers_imprinting.py index 8ce327c..dfde509 100644 --- a/tests/layers_imprinting.py +++ b/tests/layers_imprinting.py @@ -4,7 +4,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -16,7 +15,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() # first cylinder r1 = 0.5 @@ -79,7 +78,7 @@ from salome.smesh import smeshBuilder from salome.StdMeshers import StdMeshersBuilder from salome.HYBRIDPlugin import HYBRIDPluginBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() # Viscous layers without imprinting @@ -238,5 +237,3 @@ for name in faces_imprinted: area_error_3 = abs(smesh.GetArea(gr_2)-smesh.GetArea(gr_3))/smesh.GetArea(gr_2) assert area_error_3 < 1e-10 -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) diff --git a/tests/layers_imprinting_hexa_core.py b/tests/layers_imprinting_hexa_core.py index 9c3e624..6bddd93 100644 --- a/tests/layers_imprinting_hexa_core.py +++ b/tests/layers_imprinting_hexa_core.py @@ -6,7 +6,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -18,7 +17,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() # first cylinder r1 = 0.5 @@ -81,7 +80,7 @@ from salome.smesh import smeshBuilder from salome.StdMeshers import StdMeshersBuilder from salome.HYBRIDPlugin import HYBRIDPluginBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() # Viscous layers with imprinting (hexa core) # ========================================== @@ -150,6 +149,3 @@ for name in faces_imprinted: area_error_1 = abs(geom_area-smesh.GetArea(gr_4))/geom_area assert area_error_1 < 0.025 - -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) diff --git a/tests/mg_hybrid_pyramids.py b/tests/mg_hybrid_pyramids.py index f546b5b..7aab008 100644 --- a/tests/mg_hybrid_pyramids.py +++ b/tests/mg_hybrid_pyramids.py @@ -5,7 +5,6 @@ import sys import salome salome.salome_init() -theStudy = salome.myStudy ### ### GEOM component @@ -17,7 +16,7 @@ import math import SALOMEDS -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() box_side = 200 @@ -39,7 +38,7 @@ geompy.addToStudy( Box_1, 'Box_1' ) import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() Mesh_1 = smesh.Mesh(Box_1) MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf) MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters() @@ -87,6 +86,3 @@ assert abs(vol_mesh_2-vol_box)/vol_box < 1e-4 # Check number of pyramids assert Mesh_2.NbPyramids() > 1000 - -if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(True)