[Ref] don't shadow ref property
This commit is contained in:
parent
26cc0290b9
commit
9adfcac437
2 changed files with 18 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ class Ref(
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
'_mirrored',
|
'_mirrored',
|
||||||
# inherited
|
# inherited
|
||||||
'_offset', '_rotation', 'scale', '_repetition', '_annotations',
|
'_offset', '_rotation', '_scale', '_repetition', '_annotations',
|
||||||
)
|
)
|
||||||
|
|
||||||
_mirrored: bool
|
_mirrored: bool
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
from typing import cast, TYPE_CHECKING
|
from typing import cast, TYPE_CHECKING
|
||||||
|
import pytest
|
||||||
from numpy.testing import assert_equal, assert_allclose
|
from numpy.testing import assert_equal, assert_allclose
|
||||||
from numpy import pi
|
from numpy import pi
|
||||||
|
|
||||||
|
from ..error import MasqueError
|
||||||
from ..pattern import Pattern
|
from ..pattern import Pattern
|
||||||
from ..ref import Ref
|
from ..ref import Ref
|
||||||
from ..repetition import Grid
|
from ..repetition import Grid
|
||||||
|
|
@ -70,3 +72,18 @@ def test_ref_copy() -> None:
|
||||||
|
|
||||||
ref2.offset[0] = 100
|
ref2.offset[0] = 100
|
||||||
assert ref1.offset[0] == 1
|
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue