misc cleanup (mostly type-related)
This commit is contained in:
parent
7ad59d6b89
commit
ebfe1b559c
16 changed files with 57 additions and 21 deletions
|
|
@ -1,11 +1,12 @@
|
|||
from pathlib import Path
|
||||
from typing import cast
|
||||
import numpy
|
||||
from numpy.testing import assert_equal, assert_allclose
|
||||
|
||||
from ..pattern import Pattern
|
||||
from ..library import Library
|
||||
from ..file import gdsii
|
||||
from ..shapes import Path as MPath
|
||||
from ..shapes import Path as MPath, Polygon
|
||||
|
||||
|
||||
def test_gdsii_roundtrip(tmp_path: Path) -> None:
|
||||
|
|
@ -36,14 +37,14 @@ def test_gdsii_roundtrip(tmp_path: Path) -> None:
|
|||
assert "ref_cell" in read_lib
|
||||
|
||||
# Check polygon
|
||||
read_poly = read_lib["poly_cell"].shapes[(1, 0)][0]
|
||||
read_poly = cast("Polygon", read_lib["poly_cell"].shapes[(1, 0)][0])
|
||||
# GDSII closes polygons, so it might have an extra vertex or different order
|
||||
assert len(read_poly.vertices) >= 4
|
||||
# Check bounds as a proxy for geometry correctness
|
||||
assert_equal(read_lib["poly_cell"].get_bounds(), [[0, 0], [10, 10]])
|
||||
|
||||
# Check path
|
||||
read_path = read_lib["path_cell"].shapes[(2, 5)][0]
|
||||
read_path = cast("MPath", read_lib["path_cell"].shapes[(2, 5)][0])
|
||||
assert isinstance(read_path, MPath)
|
||||
assert read_path.width == 10
|
||||
assert_equal(read_path.vertices, [[0, 0], [100, 0]])
|
||||
|
|
@ -66,4 +67,5 @@ def test_gdsii_annotations(tmp_path: Path) -> None:
|
|||
|
||||
read_lib, _ = gdsii.readfile(gds_file)
|
||||
read_ann = read_lib["cell"].shapes[(1, 0)][0].annotations
|
||||
assert read_ann is not None
|
||||
assert read_ann["1"] == ["hello"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue