Skip to content

Commit

Permalink
test: Explicitly mark char as signed in dtype tests
Browse files Browse the repository at this point in the history
When run on a platform where `char` is unsigned by default — which is
implementation-defined.

This explicitly uses `signed char` in two tests where the sign of the
char is important (though only `test_dtype_normalized_num` fails without
this change).
  • Loading branch information
pganssle-google committed Feb 27, 2025
1 parent d8565ac commit 6049c3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_numpy_dtypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ TEST_SUBMODULE(numpy_dtypes, m) {
py::list res;
#define TEST_DTYPE(T) res.append(py::make_tuple(py::dtype::of<T>().num(), py::dtype::num_of<T>()));
TEST_DTYPE(bool)
TEST_DTYPE(char)
TEST_DTYPE(signed char)
TEST_DTYPE(unsigned char)
TEST_DTYPE(short)
TEST_DTYPE(unsigned short)
Expand Down Expand Up @@ -545,7 +545,7 @@ TEST_SUBMODULE(numpy_dtypes, m) {
res.append(py::make_tuple(py::dtype(py::detail::npy_api::NT).normalized_num(), \
py::dtype::num_of<T>()));
TEST_DTYPE(NPY_BOOL_, bool)
TEST_DTYPE(NPY_BYTE_, char);
TEST_DTYPE(NPY_BYTE_, signed char);
TEST_DTYPE(NPY_UBYTE_, unsigned char);
TEST_DTYPE(NPY_SHORT_, short);
TEST_DTYPE(NPY_USHORT_, unsigned short);
Expand Down

0 comments on commit 6049c3c

Please sign in to comment.