mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
parent
775c307068
commit
6269fec171
3 changed files with 15 additions and 6 deletions
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue