Skip to content

Commit

Permalink
stricter
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Aug 25, 2024
1 parent 0b2f21b commit d54210c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xarray/namedarray/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ def _new(
attributes you want to store with the array.
Will copy the attrs from x by default.
"""
if not isinstance(data, _arrayfunction_or_api):
raise NotImplementedError(
f"data is not a valid duckarray, got {data=}, {dims=}"
)
return _new(self, dims, data, attrs)

def _replace(
Expand Down Expand Up @@ -351,6 +355,10 @@ def _replace(
attributes you want to store with the array.
Will copy the attrs from x by default.
"""
if not isinstance(data, _arrayfunction_or_api):
raise NotImplementedError(
f"data is not a valid duckarray, got {data=}, {dims=}"
)
return cast("Self", self._new(dims, data, attrs))

def _copy(
Expand Down

0 comments on commit d54210c

Please sign in to comment.