[ILibrary.add] respect mutate_other=False even without duplicate keys

This commit is contained in:
Jan Petykiewicz 2026-03-31 23:47:09 -07:00
commit f461222852
2 changed files with 18 additions and 2 deletions

View file

@ -221,6 +221,17 @@ def test_library_rename() -> None:
assert "old" not in lib["parent"].refs
def test_library_add_no_duplicates_respects_mutate_other_false() -> None:
src_pat = Pattern(ports={"A": Port((0, 0), 0)})
lib = Library({"a": Pattern()})
lib.add({"b": src_pat}, mutate_other=False)
assert lib["b"] is not src_pat
lib["b"].ports["A"].offset[0] = 123
assert tuple(src_pat.ports["A"].offset) == (0.0, 0.0)
def test_library_subtree() -> None:
lib = Library()
lib["a"] = Pattern()