Skip to content

Commit 2fc76eb

Browse files
fix formatting and tests
1 parent 05ed17b commit 2fc76eb

File tree

1 file changed

+43
-11
lines changed

1 file changed

+43
-11
lines changed

tests/test_components/test_grid_spec.py

+43-11
Original file line numberDiff line numberDiff line change
@@ -542,27 +542,60 @@ def test_uniform_grid_dl_validation(dl, expect_exception):
542542
run_time=1e-12,
543543
)
544544

545-
546-
def test_dl_min_from_smallest_feature():
547545

546+
def test_dl_min_from_smallest_feature():
548547
structure = td.Structure(
549-
geometry=td.PolySlab(vertices=[[0, 0], [2, 0], [2, 1], [1, 1], [1, 1.1], [2, 1.1], [2, 2], [1, 2], [1, 2.2], [0.7, 2.2], [0.7, 2], [0, 2]], slab_bounds=[-1, 1], axis=2),
548+
geometry=td.PolySlab(
549+
vertices=[
550+
[0, 0],
551+
[2, 0],
552+
[2, 1],
553+
[1, 1],
554+
[1, 1.1],
555+
[2, 1.1],
556+
[2, 2],
557+
[1, 2],
558+
[1, 2.2],
559+
[0.7, 2.2],
560+
[0.7, 2],
561+
[0, 2],
562+
],
563+
slab_bounds=[-1, 1],
564+
axis=2,
565+
),
550566
medium=td.PECMedium(),
551567
)
552568

553569
# check expected dl_min
554-
layer_spec = td.LayerRefinementSpec(axis=2, size=(td.inf, td.inf, 2), corner_finder=td.CornerFinderSpec(dl_min_spec=td.SmallestFeatureSpec(convex_resolution=10, concave_resolution=0, mixed_resolution=0)))
570+
layer_spec = td.LayerRefinementSpec(
571+
axis=2,
572+
size=(td.inf, td.inf, 2),
573+
corner_finder=td.CornerFinderSpec(
574+
convex_resolution=10, concave_resolution=None, mixed_resolution=None
575+
),
576+
)
555577
dl_min = layer_spec._dl_min_from_smallest_feature([structure])
556-
assert(np.allclose(0.3 / 10, dl_min))
578+
assert np.allclose(0.3 / 10, dl_min)
557579

558-
layer_spec = td.LayerRefinementSpec(axis=2, size=(td.inf, td.inf, 2), corner_finder=td.CornerFinderSpec(dl_min_spec=td.SmallestFeatureSpec(convex_resolution=0, concave_resolution=0, mixed_resolution=10)))
580+
layer_spec = td.LayerRefinementSpec(
581+
axis=2,
582+
size=(td.inf, td.inf, 2),
583+
corner_finder=td.CornerFinderSpec(
584+
convex_resolution=None, concave_resolution=None, mixed_resolution=10
585+
),
586+
)
559587
dl_min = layer_spec._dl_min_from_smallest_feature([structure])
560-
assert(np.allclose(0.2 / 10, dl_min))
588+
assert np.allclose(0.2 / 10, dl_min)
561589

562-
layer_spec = td.LayerRefinementSpec(axis=2, size=(td.inf, td.inf, 2), corner_finder=td.CornerFinderSpec(dl_min_spec=td.SmallestFeatureSpec(convex_resolution=0, concave_resolution=10, mixed_resolution=0)))
590+
layer_spec = td.LayerRefinementSpec(
591+
axis=2,
592+
size=(td.inf, td.inf, 2),
593+
corner_finder=td.CornerFinderSpec(
594+
convex_resolution=None, concave_resolution=10, mixed_resolution=None
595+
),
596+
)
563597
dl_min = layer_spec._dl_min_from_smallest_feature([structure])
564-
assert(np.allclose(0.1 / 10, dl_min))
565-
598+
assert np.allclose(0.1 / 10, dl_min)
566599

567600
# check grid is generated succesfully
568601
sim = td.Simulation(
@@ -573,4 +606,3 @@ def test_dl_min_from_smallest_feature():
573606
)
574607

575608
_ = sim.grid
576-

0 commit comments

Comments
 (0)