|
20 | 20 | from collections import namedtuple |
21 | 21 | import os |
22 | 22 | import string |
| 23 | +import struct |
23 | 24 |
|
24 | 25 | import hypothesis.strategies as strategies |
25 | 26 | from hypothesis import example, given |
@@ -246,17 +247,17 @@ def test_write_header(tmpdir): |
246 | 247 | with open(testfile, 'rb') as fh: |
247 | 248 | header_bytes = fh.read() |
248 | 249 | # check for magic number |
249 | | - assert int.from_bytes(header_bytes[:4], byteorder='little') == 84 |
| 250 | + assert struct.unpack('i', header_bytes[:4])[0] == 84 |
250 | 251 | # magic number should be written again before remark section |
251 | | - assert int.from_bytes(header_bytes[88:92], byteorder='little') == 84 |
| 252 | + assert struct.unpack('i', header_bytes[88:92])[0] == 84 |
252 | 253 | # length of remark section. We hard code this to 244 right now |
253 | | - assert int.from_bytes(header_bytes[92:96], byteorder='little') == 244 |
| 254 | + assert struct.unpack('i', header_bytes[92:96])[0] == 244 |
254 | 255 | # say we have 3 block of length 80 |
255 | | - assert int.from_bytes(header_bytes[96:100], byteorder='little') == 3 |
| 256 | + assert struct.unpack('i', header_bytes[96:100])[0] == 3 |
256 | 257 | # after the remark section the length should be reported again |
257 | | - assert int.from_bytes(header_bytes[340:344], byteorder='little') == 244 |
| 258 | + assert struct.unpack('i', header_bytes[340:344])[0] == 244 |
258 | 259 | # this is a magic number as far as I see |
259 | | - assert int.from_bytes(header_bytes[344:348], byteorder='little') == 4 |
| 260 | + assert struct.unpack('i', header_bytes[344:348])[0] == 4 |
260 | 261 |
|
261 | 262 |
|
262 | 263 | def test_write_no_header(tmpdir): |
|
0 commit comments