Skip to content

Commit a25cb6c

Browse files
Merge pull request #2343 from flexcompute/groberts-flex/fix_geometry_tests
fix[testing]: fixed test_geometry bounds checking tests
2 parents 382f204 + 0104e68 commit a25cb6c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/test_components/test_geometry.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import shapely
1313
import tidy3d as td
1414
import trimesh
15-
from tidy3d.components.geometry.base import Planar
1615
from tidy3d.components.geometry.mesh import AREA_SIZE_THRESHOLD
1716
from tidy3d.components.geometry.utils import (
1817
SnapBehavior,
@@ -160,8 +159,15 @@ def test_bounds(component):
160159
_ = component.bounds
161160

162161

163-
def test_planar_bounds():
164-
_ = Planar.bounds.fget(CYLINDER)
162+
@pytest.mark.parametrize(
163+
"component,expected_bounds",
164+
[
165+
(CYLINDER, ((-1.0, -1.0, -0.5), (1.0, 1.0, 0.5))),
166+
(POLYSLAB, ((0.0, 0.0, -0.5), (1.0, 1.0, 0.5))),
167+
],
168+
)
169+
def test_planar_bounds(component, expected_bounds):
170+
assert all(a == b for a, b in zip(component.bounds, expected_bounds))
165171

166172

167173
@pytest.mark.parametrize("component", GEO_TYPES)
@@ -214,10 +220,6 @@ def test_intersections_plane_inf():
214220
assert len(c.intersections_plane(y=0)) == 1
215221

216222

217-
def test_bounds_base():
218-
assert all(a == b for a, b in zip(Planar.bounds.fget(POLYSLAB), POLYSLAB.bounds))
219-
220-
221223
def test_center_not_inf_validate():
222224
with pytest.raises(pydantic.ValidationError):
223225
_ = td.Box(center=(td.inf, 0, 0))

0 commit comments

Comments
 (0)