Skip to content

Commit

Permalink
Use bi.itemsize to disambiguate "l" or "L"
Browse files Browse the repository at this point in the history
  • Loading branch information
rwgk committed May 19, 2023
1 parent 7f124bb commit d432ce7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_buffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def test_format_descriptor_format(cpp_name, expected_fmts, np_array_dtype):
if np_array_dtype is not None:
na = np.array([], dtype=np_array_dtype)
bi = m.get_buffer_info(na)
if fmt in ("i", "q"):
assert bi.format in [fmt, "l"]
elif fmt in ("I", "Q"):
assert bi.format in [fmt, "L"]
else:
assert bi.format == fmt
bif = bi.format
if bif == "l":
bif = "i" if bi.itemsize == 4 else "q"
elif bif == "L":
bif = "I" if bi.itemsize == 4 else "Q"
assert bif == fmt


def test_from_python():
Expand Down

0 comments on commit d432ce7

Please sign in to comment.