[Ref] don't shadow ref property

This commit is contained in:
Jan Petykiewicz 2026-03-30 21:07:13 -07:00
commit 9adfcac437
2 changed files with 18 additions and 1 deletions

View file

@ -44,7 +44,7 @@ class Ref(
__slots__ = (
'_mirrored',
# inherited
'_offset', '_rotation', 'scale', '_repetition', '_annotations',
'_offset', '_rotation', '_scale', '_repetition', '_annotations',
)
_mirrored: bool

View file

@ -1,7 +1,9 @@
from typing import cast, TYPE_CHECKING
import pytest
from numpy.testing import assert_equal, assert_allclose
from numpy import pi
from ..error import MasqueError
from ..pattern import Pattern
from ..ref import Ref
from ..repetition import Grid
@ -70,3 +72,18 @@ def test_ref_copy() -> None:
ref2.offset[0] = 100
assert ref1.offset[0] == 1
def test_ref_rejects_nonpositive_scale() -> None:
with pytest.raises(MasqueError, match='Scale must be positive'):
Ref(scale=0)
with pytest.raises(MasqueError, match='Scale must be positive'):
Ref(scale=-1)
def test_ref_scale_by_rejects_nonpositive_scale() -> None:
ref = Ref(scale=2.0)
with pytest.raises(MasqueError, match='Scale must be positive'):
ref.scale_by(-1)