From d0b48e6bfcf59fcff985d18693c746b52fc3fa87 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 8 Mar 2026 10:15:09 -0700 Subject: [PATCH] [tests] fix some tests --- masque/test/test_autotool_refactor.py | 9 ++++++--- masque/test/test_shape_advanced.py | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/masque/test/test_autotool_refactor.py b/masque/test/test_autotool_refactor.py index c95c082..677ddd6 100644 --- a/masque/test/test_autotool_refactor.py +++ b/masque/test/test_autotool_refactor.py @@ -6,8 +6,7 @@ from masque.builder.tools import AutoTool from masque.pattern import Pattern from masque.ports import Port from masque.library import Library -from masque.builder.pather import Pather -from masque.builder.renderpather import RenderPather +from masque.builder.pather import Pather, RenderPather def make_straight(length, width=2, ptype="wire"): pat = Pattern() @@ -18,13 +17,17 @@ def make_straight(length, width=2, ptype="wire"): def make_bend(R, width=2, ptype="wire", clockwise=True): pat = Pattern() - # 90 degree arc + # 90 degree arc approximation (just two rects for start and end) if clockwise: # (0,0) rot 0 to (R, -R) rot pi/2 + pat.rect((1, 0), xmin=0, xmax=R, yctr=0, ly=width) + pat.rect((1, 0), xctr=R, lx=width, ymin=-R, ymax=0) pat.ports["A"] = Port((0, 0), 0, ptype=ptype) pat.ports["B"] = Port((R, -R), pi/2, ptype=ptype) else: # (0,0) rot 0 to (R, R) rot -pi/2 + pat.rect((1, 0), xmin=0, xmax=R, yctr=0, ly=width) + pat.rect((1, 0), xctr=R, lx=width, ymin=0, ymax=R) pat.ports["A"] = Port((0, 0), 0, ptype=ptype) pat.ports["B"] = Port((R, R), -pi/2, ptype=ptype) return pat diff --git a/masque/test/test_shape_advanced.py b/masque/test/test_shape_advanced.py index f6ba69d..4e38e55 100644 --- a/masque/test/test_shape_advanced.py +++ b/masque/test/test_shape_advanced.py @@ -10,6 +10,7 @@ from ..error import PatternError # 1. Text shape tests def test_text_to_polygons() -> None: + pytest.importorskip("freetype") font_path = "/usr/share/fonts/truetype/dejavu/DejaVuMathTeXGyre.ttf" if not Path(font_path).exists(): pytest.skip("Font file not found") @@ -28,6 +29,8 @@ def test_text_to_polygons() -> None: # 2. Manhattanization tests def test_manhattanize() -> None: + pytest.importorskip("float_raster") + pytest.importorskip("skimage.measure") # Diamond shape poly = Polygon([[0, 5], [5, 10], [10, 5], [5, 0]]) grid = numpy.arange(0, 11, 1)