@@ -149,13 +149,13 @@ def test_pack_nan():
149
149
150
150
def test_pack_large_long ():
151
151
for fmt in ('l' , 'q' ):
152
- assert struct .pack (fmt , 0 ) == b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
153
- assert struct .unpack (fmt , b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 ' ) == (0 ,)
154
- assert struct .pack (fmt , - 1 ) == b'\xff \xff \xff \xff \xff \xff \xff \xff '
155
- assert struct .unpack (fmt , b'\xff \xff \xff \xff \xff \xff \xff \xff ' ) == (- 1 ,)
152
+ assert struct .pack (fmt , 0 ) == b'\x00 ' * struct . calcsize ( fmt )
153
+ assert struct .unpack (fmt , b'\x00 ' * struct . calcsize ( fmt ) ) == (0 ,)
154
+ assert struct .pack (fmt , - 1 ) == b'\xff ' * struct . calcsize ( fmt )
155
+ assert struct .unpack (fmt , b'\xff ' * struct . calcsize ( fmt ) ) == (- 1 ,)
156
156
157
157
for fmt in ('L' , 'Q' ):
158
- assert struct .pack (fmt , 0 ) == b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
159
- assert struct .unpack (fmt , b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 ' ) == (0 ,)
158
+ assert struct .pack (fmt , 0 ) == b'\x00 ' * struct . calcsize ( fmt )
159
+ assert struct .unpack (fmt , b'\x00 ' * struct . calcsize ( fmt ) ) == (0 ,)
160
160
assert struct .pack (fmt , 18446744073709551615 ) == b'\xff \xff \xff \xff \xff \xff \xff \xff '
161
161
assert struct .unpack (fmt , b'\xff \xff \xff \xff \xff \xff \xff \xff ' ) == (18446744073709551615 ,)
0 commit comments