File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
testsuite/MDAnalysisTests/formats Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,24 @@ def test_write_header(tmpdir):
242242 assert header ['nsavc' ] == 10
243243 assert np .allclose (header ['delta' ], .02 )
244244
245+ # we also check the bytes written directly
246+
247+ with open (testfile , 'br' ) as fh :
248+ header_bytes = fh .read ()
249+
250+ # check for magic number
251+ assert int .from_bytes (header_bytes [:4 ], byteorder = 'little' ) == 84
252+ # magic number should be written again before remark section
253+ assert int .from_bytes (header_bytes [88 :92 ], byteorder = 'little' ) == 84
254+ # length of remark section. We hard code this to 244 right now
255+ assert int .from_bytes (header_bytes [92 :96 ], byteorder = 'little' ) == 244
256+ # say we have 3 block of length 80
257+ assert int .from_bytes (header_bytes [96 :100 ], byteorder = 'little' ) == 3
258+ # after the remark section the length should be reported again
259+ assert int .from_bytes (header_bytes [340 :344 ], byteorder = 'little' ) == 244
260+ # this is a magic number as far as I see
261+ assert int .from_bytes (header_bytes [344 :348 ], byteorder = 'little' ) == 4
262+
245263
246264def test_write_no_header (tmpdir ):
247265 fname = str (tmpdir .join ('test.dcd' ))
You can’t perform that action at this time.
0 commit comments