Skip to content

Commit

Permalink
Exclude HDF5 from unsigned char roundtrip on ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 6, 2023
1 parent 600d12d commit 8b138bf
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/python/unittest/API/APITest.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,25 @@ def attributeRoundTrip(self, file_ending):
self.assertEqual(series.get_attribute("char"), "c")
self.assertEqual(series.get_attribute("pystring"), "howdy!")
self.assertEqual(series.get_attribute("pystring2"), "howdy, too!")
self.assertEqual(bytes(series.get_attribute("pystring3")),
b"howdy, again!")
if file_ending == 'h5':
# A byte string b"hello" is always (really?) a vector of unsigned
# chars.
# HDF5 does not distinguish a platform char type, only explicitly
# signed or unsigned chars. Depending on the signed-ness of char
# on the current platform, the unsigned char from the byte string
# might then be interpreted as a char, not as an unsigned char.
# This means that the roundtrip might not work on platforms with
# unsigned char.
try:
as_bytes = bytes(series.get_attribute("pystring3"))
self.assertEqual(as_bytes, b"howdy, again!")
except TypeError:
self.assertEqual(
series.get_attribute("pystring3"),
[c for c in "howdy, again!"])
else:
self.assertEqual(bytes(series.get_attribute("pystring3")),
b"howdy, again!")
self.assertEqual(series.get_attribute("pyint"), 13)
self.assertAlmostEqual(series.get_attribute("pyfloat"), 3.1416)
self.assertEqual(series.get_attribute("pybool"), False)
Expand Down

0 comments on commit 8b138bf

Please sign in to comment.