summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_struct.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_struct.py')
-rw-r--r--Lib/test/test_struct.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index 232bffc..7f5f08b 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -2,6 +2,8 @@ import array
import unittest
import struct
import warnings
+warnings.filterwarnings("ignore", "struct integer overflow masking is deprecated",
+ DeprecationWarning)
from functools import wraps
from test.test_support import TestFailed, verbose, run_unittest
@@ -461,6 +463,11 @@ class StructTest(unittest.TestCase):
self.check_float_coerce(endian + fmt, 1.0)
self.check_float_coerce(endian + fmt, 1.5)
+ def test_issue4228(self):
+ # Packing a long may yield either 32 or 64 bits
+ x = struct.pack('L', -1)[:4]
+ self.assertEqual(x, '\xff'*4)
+
def test_unpack_from(self):
test_string = 'abcd01234'
fmt = '4s'