Skip to content

Commit 79be5c8

Browse files
test: Explicitly mark char as signed in dtype tests (#5545)
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).
1 parent 2943a27 commit 79be5c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_numpy_dtypes.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ TEST_SUBMODULE(numpy_dtypes, m) {
512512
py::list res;
513513
#define TEST_DTYPE(T) res.append(py::make_tuple(py::dtype::of<T>().num(), py::dtype::num_of<T>()));
514514
TEST_DTYPE(bool)
515-
TEST_DTYPE(char)
515+
TEST_DTYPE(signed char)
516516
TEST_DTYPE(unsigned char)
517517
TEST_DTYPE(short)
518518
TEST_DTYPE(unsigned short)
@@ -545,7 +545,7 @@ TEST_SUBMODULE(numpy_dtypes, m) {
545545
res.append(py::make_tuple(py::dtype(py::detail::npy_api::NT).normalized_num(), \
546546
py::dtype::num_of<T>()));
547547
TEST_DTYPE(NPY_BOOL_, bool)
548-
TEST_DTYPE(NPY_BYTE_, char);
548+
TEST_DTYPE(NPY_BYTE_, signed char);
549549
TEST_DTYPE(NPY_UBYTE_, unsigned char);
550550
TEST_DTYPE(NPY_SHORT_, short);
551551
TEST_DTYPE(NPY_USHORT_, unsigned short);

0 commit comments

Comments
 (0)