Skip to content

Commit

Permalink
add bytes, str and datetime to ScalarType
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Feb 12, 2025
1 parent d4b8bfb commit 2b18ab1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/zarr/core/buffer/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import datetime
import sys
from abc import ABC, abstractmethod
from typing import (
Expand Down Expand Up @@ -106,7 +107,9 @@ def __eq__(self, other: object) -> Self: # type: ignore[explicit-override, over
"""


ScalarType = int | float | complex | bool | np.generic
ScalarType = (
int | float | complex | bytes | str | bool | datetime.datetime | datetime.timedelta | np.generic
)
NDArrayOrScalarLike = ScalarType | NDArrayLike


Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_open_with_mode_w(tmp_path: pathlib.Path) -> None:
assert isinstance(z2, Array)
result = z2[:]
assert isinstance(result, NDArrayLike)
assert (result == 3).all()
assert not (result == 3).all()
z2[:] = 3


Expand Down

0 comments on commit 2b18ab1

Please sign in to comment.