enable annotations=None by default
This commit is contained in:
parent
4aca8acd3d
commit
b6ee0d4929
4 changed files with 45 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ if not gdsii_arrow.is_available():
|
|||
|
||||
|
||||
def _annotations_key(annotations: dict[str, list[object]] | None) -> tuple[tuple[str, tuple[object, ...]], ...] | None:
|
||||
if annotations is None:
|
||||
if not annotations:
|
||||
return None
|
||||
return tuple(sorted((key, tuple(values)) for key, values in annotations.items()))
|
||||
|
||||
|
|
@ -228,6 +228,25 @@ def test_raw_ref_grid_label_constructors_match_public() -> None:
|
|||
public_grid = Grid(a_vector=(20, 0), a_count=3, b_vector=(0, 30), b_count=2)
|
||||
assert raw_grid == public_grid
|
||||
|
||||
raw_ref_empty = Ref._from_raw(
|
||||
offset=numpy.array([100, 200]),
|
||||
rotation=numpy.pi / 2,
|
||||
mirrored=False,
|
||||
scale=1.0,
|
||||
repetition=None,
|
||||
annotations=None,
|
||||
)
|
||||
public_ref_empty = Ref(
|
||||
offset=(100, 200),
|
||||
rotation=numpy.pi / 2,
|
||||
mirrored=False,
|
||||
scale=1.0,
|
||||
repetition=None,
|
||||
annotations=None,
|
||||
)
|
||||
assert raw_ref_empty.annotations is None
|
||||
assert raw_ref_empty == public_ref_empty
|
||||
|
||||
raw_ref = Ref._from_raw(
|
||||
offset=numpy.array([100, 200]),
|
||||
rotation=numpy.pi / 2,
|
||||
|
|
@ -247,6 +266,19 @@ def test_raw_ref_grid_label_constructors_match_public() -> None:
|
|||
assert raw_ref == public_ref
|
||||
assert numpy.array_equal(raw_ref.as_transforms(), public_ref.as_transforms())
|
||||
|
||||
raw_label_empty = Label._from_raw(
|
||||
'LEAF',
|
||||
offset=numpy.array([3, 4]),
|
||||
annotations=None,
|
||||
)
|
||||
public_label_empty = Label(
|
||||
'LEAF',
|
||||
offset=(3, 4),
|
||||
annotations=None,
|
||||
)
|
||||
assert raw_label_empty.annotations is None
|
||||
assert raw_label_empty == public_label_empty
|
||||
|
||||
raw_label = Label._from_raw(
|
||||
'LEAF',
|
||||
offset=numpy.array([3, 4]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue