aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Rivera <stefano@rivera.za.net>2020-10-09 10:02:19 -0700
committerStefano Rivera <stefano@rivera.za.net>2020-10-09 10:02:19 -0700
commit5a0cc5cf580b681b37a74811f4593bbf83887f2b (patch)
treee4ff184b3714e66f805c60d6d3315ee9f8e982d7 /extra_tests
parentReplace more test_support with support. Bad merge? (diff)
downloadpypy-5a0cc5cf580b681b37a74811f4593bbf83887f2b.tar.gz
pypy-5a0cc5cf580b681b37a74811f4593bbf83887f2b.tar.bz2
pypy-5a0cc5cf580b681b37a74811f4593bbf83887f2b.zip
fix test
(grafted from c8644313626b882272ff489a1a4c8eca55a58426)
Diffstat (limited to 'extra_tests')
-rw-r--r--extra_tests/ctypes_tests/test_buffers.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/extra_tests/ctypes_tests/test_buffers.py b/extra_tests/ctypes_tests/test_buffers.py
index 1e360a62b3..d71819bf06 100644
--- a/extra_tests/ctypes_tests/test_buffers.py
+++ b/extra_tests/ctypes_tests/test_buffers.py
@@ -45,6 +45,9 @@ def normalize(fmt):
else:
return fmt
+s_long = {4: 'l', 8: 'q'}[sizeof(c_long)]
+s_ulong = {4: 'L', 8: 'Q'}[sizeof(c_long)]
+
@pytest.mark.parametrize("tp, fmt", [
## simple types
(c_char, "<c"),
@@ -52,15 +55,15 @@ def normalize(fmt):
(c_ubyte, "<B"),
(c_short, "<h"),
(c_ushort, "<H"),
- (c_long, "<l"),
- (c_ulong, "<L"),
+ (c_long, f"<{s_long}"),
+ (c_ulong, f"<{s_ulong}"),
(c_float, "<f"),
(c_double, "<d"),
(c_bool, "<?"),
(py_object, "<O"),
## pointers
(POINTER(c_byte), "&<b"),
- (POINTER(POINTER(c_long)), "&&<l"),
+ (POINTER(POINTER(c_long)), f"&&<{s_long}"),
## arrays and pointers
(c_double * 4, "<d"),
(c_float * 4 * 3 * 2, "<f"),