Skip to content

Commit

Permalink
ensure step is int (#766)
Browse files Browse the repository at this point in the history
* ensure step is `int`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* some more tests

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
PythonFZ and pre-commit-ci[bot] authored Dec 13, 2024
1 parent 317a485 commit 2160654
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def test_step(server, s22):
vis.extend(s22)

assert vis.step == 0
assert isinstance(vis.step, int)

assert len(vis) == 22

Expand All @@ -23,3 +24,4 @@ def test_step(server, s22):

vis.step = 5
assert vis.step == 5
assert isinstance(vis.step, int)
8 changes: 5 additions & 3 deletions zndraw/zndraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,11 @@ def selection(self, value: list[int]):
@property
def step(self) -> int:
try:
return znsocket.Dict(
self.r, f"room:{self.token}:step", socket=self._refresh_client
)["grp-0"]
return int(
znsocket.Dict(
self.r, f"room:{self.token}:step", socket=self._refresh_client
)["grp-0"]
)
except KeyError:
return 0

Expand Down

0 comments on commit 2160654

Please sign in to comment.