Skip to content

Commit 96d7cd6

Browse files
Merge pull request #126 from Geode-solutions/fix/pb-coloc-python
Fix/pb coloc python
2 parents 9ee2408 + a061d57 commit 96d7cd6

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

bindings/python/tests/test-py-edgedcurve-colocation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import opengeode as geode
3030
import opengeode_inspector_py_inspector as inspector
3131

32-
3332
def check_non_colocation2D():
3433
curve = geode.EdgedCurve2D.create()
3534
builder = geode.EdgedCurveBuilder2D.create(curve)
@@ -63,15 +62,16 @@ def check_colocation2D():
6362
if not colocation_inspector.mesh_has_colocated_points():
6463
raise ValueError(
6564
"[Test] EdgedCurve doesn't have colocated points whereas it should have several.")
66-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
65+
issues = colocation_inspector.colocated_points_groups()
66+
if not issues.nb_issues() == 2:
6767
raise ValueError(
6868
"[Test] EdgedCurve has wrong number of colocated points groups.")
6969
first_colocated_points_group = [0, 1, 6]
7070
second_colocated_points_group = [3, 5]
71-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
71+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
7272
raise ValueError(
7373
"[Test] EdgedCurve has wrong first colocated points group.")
74-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
74+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
7575
raise ValueError(
7676
"[Test] EdgedCurve has wrong second colocated points group.")
7777

@@ -110,15 +110,16 @@ def check_colocation3D():
110110
if not colocation_inspector.mesh_has_colocated_points():
111111
raise ValueError(
112112
"[Test] (3D) EdgedCurve doesn't have colocated points whereas it should have several.")
113-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
113+
issues = colocation_inspector.colocated_points_groups()
114+
if not issues.nb_issues() == 2:
114115
raise ValueError(
115116
"[Test] (3D) EdgedCurve has wrong number ofgroup of colocated points.")
116117
first_colocated_points_group = [0, 1, 6]
117118
second_colocated_points_group = [3, 5]
118-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
119+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
119120
raise ValueError(
120121
"[Test] (3D) EdgedCurve has wrong first colocated points group.")
121-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
122+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
122123
raise ValueError(
123124
"[Test] (3D) EdgedCurve has wrong second colocated points group.")
124125

bindings/python/tests/test-py-pointset-colocation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import opengeode_inspector_py_inspector as inspector
3131
print(dir(inspector))
3232

33-
3433
def check_non_colocation2D():
3534
pointset = geode.PointSet2D.create()
3635
builder = geode.PointSetBuilder2D.create(pointset)
@@ -64,15 +63,16 @@ def check_colocation2D():
6463
if not colocation_inspector.mesh_has_colocated_points():
6564
raise ValueError(
6665
"[Test] PointSet doesn't have colocated points whereas it should have several.")
67-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
66+
issues = colocation_inspector.colocated_points_groups()
67+
if not issues.nb_issues() == 2:
6868
raise ValueError(
6969
"[Test] PointSet has wrong number of group of colocated points.")
7070
first_colocated_points_group = [0, 1, 6]
7171
second_colocated_points_group = [3, 5]
72-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
72+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
7373
raise ValueError(
7474
"[Test] PointSet has wrong first colocated points group.")
75-
if colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
75+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
7676
raise ValueError(
7777
"[Test] PointSet has wrong second colocated points group.")
7878

@@ -111,15 +111,16 @@ def check_colocation3D():
111111
if not colocation_inspector.mesh_has_colocated_points():
112112
raise ValueError(
113113
"[Test] (3D) PointSet doesn't have colocated points whereas it should have several.")
114-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
114+
issues = colocation_inspector.colocated_points_groups()
115+
if not issues.nb_issues() == 2:
115116
raise ValueError(
116117
"[Test] (3D) PointSet has wrong number of colocated points.")
117118
first_colocated_points_group = [0, 1, 6]
118119
second_colocated_points_group = [3, 5]
119-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
120+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
120121
raise ValueError(
121122
"[Test] (3D) PointSet has wrong first colocated points group.")
122-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
123+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
123124
raise ValueError(
124125
"[Test] (3D) PointSet has wrong second colocated points group.")
125126

bindings/python/tests/test-py-solid-colocation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import opengeode as geode
3030
import opengeode_inspector_py_inspector as inspector
3131

32-
3332
def check_non_colocation():
3433
solid = geode.TetrahedralSolid3D.create()
3534
builder = geode.TetrahedralSolidBuilder3D.create(solid)
@@ -66,14 +65,15 @@ def check_colocation():
6665
if not colocation_inspector.mesh_has_colocated_points():
6766
raise ValueError(
6867
"[Test] Solid doesn't have colocated points whereas it should have several.")
69-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
68+
issues = colocation_inspector.colocated_points_groups()
69+
if not issues.nb_issues() == 2:
7070
raise ValueError("[Test] Solid has wrong number of colocated points.")
7171
first_colocated_points_group = [0, 1, 6]
7272
second_colocated_points_group = [3, 5]
73-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
73+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
7474
raise ValueError(
7575
"[Test] Solid has wrong first colocated points group.")
76-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
76+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
7777
raise ValueError(
7878
"[Test] Solid has wrong second colocated points group.")
7979

bindings/python/tests/test-py-surface-colocation.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import opengeode as geode
3030
import opengeode_inspector_py_inspector as inspector
3131

32-
3332
def check_non_colocation2D():
3433
surface = geode.TriangulatedSurface2D.create()
3534
builder = geode.TriangulatedSurfaceBuilder2D.create(surface)
@@ -62,16 +61,17 @@ def check_colocation2D():
6261
colocation_inspector = inspector.SurfaceMeshColocation2D(surface)
6362
if not colocation_inspector.mesh_has_colocated_points():
6463
raise ValueError(
65-
"[Test] Surface doesn't have colocated points whereas it should have several.")
66-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
64+
"[Test] Surface doesn't have colocated points whereas it should have several.")
65+
issues = colocation_inspector.colocated_points_groups()
66+
if not issues.nb_issues() == 2:
6767
raise ValueError(
6868
"[Test] Surface has wrong number of colocated points.")
6969
first_colocated_points_group = [0, 1, 6]
7070
second_colocated_points_group = [3, 5]
71-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
71+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
7272
raise ValueError(
7373
"[Test] Surface has wrong first colocated points group.")
74-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
74+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
7575
raise ValueError(
7676
"[Test] Surface has wrong second colocated points group.")
7777

@@ -110,15 +110,16 @@ def check_colocation3D():
110110
if not colocation_inspector.mesh_has_colocated_points():
111111
raise ValueError(
112112
"[Test] (3D) Surface doesn't have colocated points whereas it should have several.")
113-
if not colocation_inspector.colocated_points_groups().nb_issues() == 2:
113+
issues = colocation_inspector.colocated_points_groups()
114+
if not issues.nb_issues() == 2:
114115
raise ValueError(
115116
"[Test] (3D) Surface has wrong number of colocated points.")
116117
first_colocated_points_group = [0, 1, 6]
117118
second_colocated_points_group = [3, 5]
118-
if not colocation_inspector.colocated_points_groups().issues()[0] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[0] == second_colocated_points_group:
119+
if not issues.issues()[0] == first_colocated_points_group and not issues.issues()[0] == second_colocated_points_group:
119120
raise ValueError(
120121
"[Test] (3D) Surface has wrong first colocated points group.")
121-
if not colocation_inspector.colocated_points_groups().issues()[1] == first_colocated_points_group and not colocation_inspector.colocated_points_groups().issues()[1] == second_colocated_points_group:
122+
if not issues.issues()[1] == first_colocated_points_group and not issues.issues()[1] == second_colocated_points_group:
122123
raise ValueError(
123124
"[Test] (3D) Surface has wrong second colocated points group.")
124125

tests/inspector/test-surface-colocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void check_colocation2D()
8787
== second_colocated_points_group,
8888
"[Test] Surface has wrong first colocated points group." );
8989
OPENGEODE_EXCEPTION(
90-
colocated_points_groups.issues()[1] == second_colocated_points_group
90+
colocated_points_groups.issues()[1] == first_colocated_points_group
9191
|| colocated_points_groups.issues()[1]
9292
== second_colocated_points_group,
9393
"[Test] Surface has wrong second colocated points group." );

0 commit comments

Comments
 (0)