Skip to content

Commit 3bef736

Browse files
test: improve share topology test (#1804)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 7a41010 commit 3bef736

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

doc/changelog.d/1804.test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
improve share topology test

tests/integration/test_prepare_tools.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121
# SOFTWARE.
2222
"""Testing of prepare tools."""
2323

24+
from pint import Quantity
25+
26+
from ansys.geometry.core.math.point import Point2D
27+
from ansys.geometry.core.misc.measurements import UNITS
2428
from ansys.geometry.core.modeler import Modeler
29+
from ansys.geometry.core.sketch import Sketch
2530

2631
from .conftest import FILES_DIR
2732

@@ -53,8 +58,28 @@ def test_volume_extract_from_edge_loops(modeler: Modeler):
5358

5459
def test_share_topology(modeler: Modeler):
5560
"""Test share topology operation is between two bodies."""
56-
design = modeler.open_file(FILES_DIR / "MixingTank.scdocx")
57-
assert modeler.prepare_tools.share_topology(design.bodies)
61+
design = Modeler.create_design(modeler, "ShareTopoDoc")
62+
sketch = Sketch()
63+
sketch.box(Point2D([10, 10], UNITS.mm), Quantity(10, UNITS.mm), Quantity(10, UNITS.mm))
64+
design.extrude_sketch("JustABox", sketch, Quantity(10, UNITS.mm))
65+
sketch = Sketch()
66+
sketch.box(Point2D([20, 10], UNITS.mm), Quantity(10, UNITS.mm), Quantity(10, UNITS.mm))
67+
design.extrude_sketch("JustABox", sketch, Quantity(5, UNITS.mm))
68+
faces = 0
69+
edges = 0
70+
for body in design.bodies:
71+
faces += len(body.faces)
72+
edges += len(body.edges)
73+
assert faces == 12
74+
assert edges == 24
75+
modeler.prepare_tools.share_topology(design.bodies)
76+
faces = 0
77+
edges = 0
78+
for body in design.bodies:
79+
faces += len(body.faces)
80+
edges += len(body.edges)
81+
assert faces == 13
82+
assert edges == 27
5883

5984

6085
def test_enhanced_share_topology(modeler: Modeler):

0 commit comments

Comments
 (0)