Skip to content

Commit 622de03

Browse files
committed
Added getters for the RegularTick properties, for convenience.
1 parent 1833910 commit 622de03

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/delayedarray/RegularTicks.py

+16
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,19 @@ def __getitem__(self, i: int) -> int:
5050
elif i >= self._len:
5151
raise IndexError("'i' is out of range")
5252
return min(self._final, self._spacing * (i + 1))
53+
54+
@property
55+
def spacing(self) -> int:
56+
"""
57+
Returns:
58+
The spacing between ticks.
59+
"""
60+
return self._spacing
61+
62+
@property
63+
def final(self) -> int:
64+
"""
65+
Returns:
66+
Position of the final tick.
67+
"""
68+
return self._final

tests/test_RegularTicks.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
def test_RegularTicks():
66
out = delayedarray.RegularTicks(7, 50)
7+
assert out.spacing == 7
8+
assert out.final == 50
9+
710
ref = list(range(7, 50, 7)) + [50]
811
assert len(out) == len(ref)
912
assert list(out) == ref

0 commit comments

Comments
 (0)