Skip to content

Commit

Permalink
construct arrays with behavior/attrs...
Browse files Browse the repository at this point in the history
  • Loading branch information
lgray authored Jan 26, 2024
1 parent 6057909 commit 3d1cd35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,18 +891,22 @@ def test_shape_only_ops(fn: Callable, tmp_path_factory: pytest.TempPathFactory)
result.compute()


def test_assign_behavior(daa_p1: dak.Array) -> None:
def test_assign_behavior() -> None:
x = ak.Array([{"a": 1, "b": 2}, {"a": 3, "b": 4}], behavior={}, attrs={})
dx = dak.from_awkward(x, 3)
with pytest.raises(
TypeError, match="'mappingproxy' object does not support item assignment"
):
daa_p1.behavior["should_fail"] = None
dx.behavior["should_fail"] = None


def test_assign_attrs(daa_p1: dak.Array) -> None:
def test_assign_attrs() -> None:
x = ak.Array([{"a": 1, "b": 2}, {"a": 3, "b": 4}], behavior={}, attrs={})
dx = dak.from_awkward(x, 3)
with pytest.raises(
TypeError, match="'mappingproxy' object does not support item assignment"
):
daa_p1.attrs["should_fail"] = None
dx.attrs["should_fail"] = None


@delayed
Expand Down

0 comments on commit 3d1cd35

Please sign in to comment.