Skip to content

Commit 772c1bd

Browse files
committed
python2
1 parent 696ebeb commit 772c1bd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

testsuite/MDAnalysisTests/formats/test_libdcd.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from collections import namedtuple
2121
import os
2222
import string
23+
import struct
2324

2425
import hypothesis.strategies as strategies
2526
from hypothesis import example, given
@@ -246,17 +247,17 @@ def test_write_header(tmpdir):
246247
with open(testfile, 'rb') as fh:
247248
header_bytes = fh.read()
248249
# 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
250251
# 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
252253
# 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
254255
# 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
256257
# 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
258259
# 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
260261

261262

262263
def test_write_no_header(tmpdir):

0 commit comments

Comments
 (0)