[AutoTool] fix some masked errors
This commit is contained in:
parent
42d291b1b6
commit
412133533a
2 changed files with 38 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ from numpy.testing import assert_allclose
|
|||
|
||||
from masque.builder.tools import AutoTool, PrimitiveOffer, RenderStep, UOffer, circular_arc_sbend_endpoint
|
||||
from masque.builder.pather import Pather
|
||||
from masque.builder.error import ToolContractError
|
||||
from masque.library import Library
|
||||
from masque.pattern import Pattern
|
||||
from masque.ports import Port
|
||||
|
|
@ -522,6 +523,42 @@ def test_autotool_sbend_custom_endpoint_avoids_generator_during_planning() -> No
|
|||
assert data.mirrored is False
|
||||
|
||||
|
||||
def test_autotool_sbend_endpoint_ptype_mismatch_is_fatal() -> None:
|
||||
def make_core_sbend(jog: float) -> Pattern:
|
||||
return make_sbend(jog, ptype='core')
|
||||
|
||||
tool = (
|
||||
AutoTool()
|
||||
.add_straight(
|
||||
lambda length: make_straight(length, ptype='core'),
|
||||
'core',
|
||||
'A',
|
||||
)
|
||||
.add_sbend(
|
||||
make_core_sbend,
|
||||
'core',
|
||||
'A',
|
||||
'B',
|
||||
jog_range=(0, 20),
|
||||
endpoint=lambda jog: Port((10, jog), pi, ptype='wrong'),
|
||||
)
|
||||
.add_sbend(
|
||||
make_core_sbend,
|
||||
'core',
|
||||
'A',
|
||||
'B',
|
||||
jog_range=(0, 20),
|
||||
)
|
||||
)
|
||||
pather = Pather(Library(), tools=tool, render='deferred')
|
||||
pather.ports['A'] = Port((0, 0), 0, ptype='core')
|
||||
|
||||
with pytest.raises(ToolContractError, match='declared offer out_ptype'):
|
||||
pather.jog('A', 4, length=20)
|
||||
|
||||
assert_allclose(pather.ports['A'].offset, (0, 0))
|
||||
|
||||
|
||||
def test_circular_arc_sbend_endpoint() -> None:
|
||||
endpoint = circular_arc_sbend_endpoint(radius=5, ptype="core")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue