Skip to content

Commit 19960fa

Browse files
committed
New tests
1 parent e047bc6 commit 19960fa

File tree

2 files changed

+46
-7
lines changed

2 files changed

+46
-7
lines changed

test_link/test_projection.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import math
22
import pyMagix3D as Mgx3D
33

4-
def test_projection_cube():
4+
def test_projection_cube(capfd):
55
ctx = Mgx3D.getStdContext()
66
ctx.clearSession() # Clean the session after the previous test
77
tm = ctx.getTopoManager ()
@@ -15,7 +15,10 @@ def test_projection_cube():
1515
vert = tm.getVertexAt(Mgx3D.Point(1, 0.5, 1))
1616
assert vert == 'Som0000'
1717

18-
def test_projection_cube_inner():
18+
out, err = capfd.readouterr()
19+
assert len(err) == 0
20+
21+
def test_projection_cube_inner(capfd):
1922
ctx = Mgx3D.getStdContext()
2023
ctx.clearSession() # Clean the session after the previous test
2124
tm = ctx.getTopoManager ()
@@ -33,7 +36,10 @@ def test_projection_cube_inner():
3336
vert = tm.getVertexAt(Mgx3D.Point(.5, 0.8, 1))
3437
assert vert == 'Som0000'
3538

36-
def test_projection_disc_inner():
39+
out, err = capfd.readouterr()
40+
assert len(err) == 0
41+
42+
def test_projection_disc_inner(capfd):
3743
ctx = Mgx3D.getStdContext()
3844
ctx.clearSession() # Clean the session after the previous test
3945
tm = ctx.getTopoManager ()
@@ -49,6 +55,9 @@ def test_projection_disc_inner():
4955
vert = tm.getVertexAt(Mgx3D.Point(0, y, z))
5056
assert vert == 'Som0000'
5157

58+
out, err = capfd.readouterr()
59+
assert len(err) == 0
60+
5261
def test_projection_arc_circle(capfd):
5362
ctx = Mgx3D.getStdContext()
5463
ctx.clearSession() # Clean the session after the previous test

test_link/test_topo_block.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,46 @@
11
import pyMagix3D as Mgx3D
22

3-
def test_topo_box():
3+
def test_topo_box(capfd):
44
ctx = Mgx3D.getStdContext()
55
ctx.clearSession() # Clean the session after the previous test
6-
tm = ctx.getTopoManager ()
6+
tm = ctx.getTopoManager()
77

88
tm.newBoxWithTopo (Mgx3D.Point(0, 0, 0), Mgx3D.Point(1, 1, 1), 10, 10, 10)
99
assert tm.getNbBlocks()==1
1010
assert tm.getNbFaces()==6
1111

12-
def test_fuse_geom_topo():
12+
out, err = capfd.readouterr()
13+
assert len(err) == 0
14+
15+
def test_fuse_geom(capfd):
1316
ctx = Mgx3D.getStdContext()
1417
ctx.clearSession() # Clean the session after the previous test
1518
gm = ctx.getGeomManager()
16-
tm = ctx.getTopoManager ()
19+
tm = ctx.getTopoManager()
20+
mm = ctx.getMeshManager()
21+
22+
# Création du cylindre Vol0000
23+
gm.newCylinder (Mgx3D.Point(0, 0, 0), 1, Mgx3D.Vector(1, 0, 0), 1.800000e+02)
24+
# Création du volume Vol0001
25+
gm.newSphere (Mgx3D.Point(1, 0, 0), 1, Mgx3D.Portion.QUART)
26+
# Rotation de Vol0001 suivant [ [ 1, 0, 0] , [ 1, 0, 1] , 270]
27+
gm.rotate (["Vol0001"], Mgx3D.Rotation(Mgx3D.Point(1, 0, 0), Mgx3D.Point(1, 0, 1), 270))
28+
# Fusion Booléenne de Vol0001 Vol0000
29+
gm.fuse (["Vol0001","Vol0000"])
30+
assert gm.getNbVolumes() == 1
31+
# Création d'un bloc topologique non structuré sur une géométrie (Vol0002)
32+
tm.newUnstructuredTopoOnGeometry ("Vol0002")
33+
# Création du maillage pour tous les blocs
34+
mm.newAllBlocksMesh()
35+
36+
out, err = capfd.readouterr()
37+
assert len(err) == 0
38+
39+
def test_fuse_geom_topo(capfd):
40+
ctx = Mgx3D.getStdContext()
41+
ctx.clearSession() # Clean the session after the previous test
42+
gm = ctx.getGeomManager()
43+
tm = ctx.getTopoManager()
1744

1845
# Création d'une boite avec une topologie
1946
tm.newBoxWithTopo(Mgx3D.Point(0, 0, 0), Mgx3D.Point(1, 1, 1), 10, 10, 10)
@@ -33,3 +60,6 @@ def test_fuse_geom_topo():
3360
tm.fuse2Blocks("Bl0000","Bl0001")
3461
assert tm.getNbBlocks() == 1
3562
assert tm.getNbFaces() == 10
63+
64+
out, err = capfd.readouterr()
65+
assert len(err) == 0

0 commit comments

Comments
 (0)