summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/struct1.py5
-rw-r--r--tests/float/float2int.py5
-rw-r--r--tests/float/float2int_doubleprec.py5
-rw-r--r--tests/float/float_struct.py5
4 files changed, 16 insertions, 4 deletions
diff --git a/tests/basics/struct1.py b/tests/basics/struct1.py
index c473fc0b0c..87e2f07026 100644
--- a/tests/basics/struct1.py
+++ b/tests/basics/struct1.py
@@ -1,4 +1,7 @@
-import struct
+try:
+ import ustruct as struct
+except:
+ import struct
print(struct.calcsize("<bI"))
print(struct.unpack("<bI", b"\x80\0\0\x01\0"))
print(struct.calcsize(">bI"))
diff --git a/tests/float/float2int.py b/tests/float/float2int.py
index ca395997c4..e9bdf15de6 100644
--- a/tests/float/float2int.py
+++ b/tests/float/float2int.py
@@ -1,6 +1,9 @@
# check cases converting float to int, relying only on single precision float
-import struct
+try:
+ import ustruct as struct
+except:
+ import struct
# work out configuration values
is_64bit = struct.calcsize("P") == 8
diff --git a/tests/float/float2int_doubleprec.py b/tests/float/float2int_doubleprec.py
index 63138c0d4e..acdc8c69c4 100644
--- a/tests/float/float2int_doubleprec.py
+++ b/tests/float/float2int_doubleprec.py
@@ -1,6 +1,9 @@
# check cases converting float to int, requiring double precision float
-import struct
+try:
+ import ustruct as struct
+except:
+ import struct
# work out configuration values
is_64bit = struct.calcsize("P") == 8
diff --git a/tests/float/float_struct.py b/tests/float/float_struct.py
index 8ad0e492c6..e55890a2cd 100644
--- a/tests/float/float_struct.py
+++ b/tests/float/float_struct.py
@@ -1,6 +1,9 @@
# test struct package with floats
-import struct
+try:
+ import ustruct as struct
+except:
+ import struct
i = 1. + 1/2
# TODO: it looks like '=' format modifier is not yet supported