Skip to content

Commit bde404e

Browse files
committed
tests for BytesCodec.to_dict
1 parent aabb3d7 commit bde404e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/test_codecs/test_bytes.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Literal
1+
from typing import Any, Literal
22

33
import numpy as np
44
import pytest
@@ -58,3 +58,21 @@ async def test_endian_write(
5858
await _AsyncArrayProxy(a)[:, :].set(data)
5959
readback_data = await _AsyncArrayProxy(a)[:, :].get()
6060
assert np.array_equal(data, readback_data)
61+
62+
63+
@pytest.mark.parametrize(
64+
("endian", "expected"),
65+
[
66+
pytest.param(
67+
"little", {"name": "bytes", "configuration": {"endian": "little"}}, id="little"
68+
),
69+
pytest.param("big", {"name": "bytes", "configuration": {"endian": "big"}}, id="big"),
70+
pytest.param(None, {"name": "bytes"}, id="missing"),
71+
],
72+
)
73+
def test_to_dict(endian: str, expected: dict[str, Any]) -> None:
74+
codec = BytesCodec(endian=endian)
75+
76+
actual = codec.to_dict()
77+
78+
assert actual == expected

0 commit comments

Comments
 (0)