[Ref / Label] make equality safe for unrelated types

This commit is contained in:
Jan Petykiewicz 2026-03-31 17:51:02 -07:00
commit 2e0b64bdab
4 changed files with 16 additions and 0 deletions

View file

@ -46,3 +46,9 @@ def test_label_copy() -> None:
assert l1 is not l2
l2.offset[0] = 100
assert l1.offset[0] == 1
def test_label_eq_unrelated_objects_is_false() -> None:
lbl = Label("test")
assert not (lbl == None)
assert not (lbl == object())

View file

@ -87,3 +87,9 @@ def test_ref_scale_by_rejects_nonpositive_scale() -> None:
with pytest.raises(MasqueError, match='Scale must be positive'):
ref.scale_by(-1)
def test_ref_eq_unrelated_objects_is_false() -> None:
ref = Ref()
assert not (ref == None)
assert not (ref == object())