Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRZ reader and writer are compatible with python 3 #690

Merged
merged 7 commits into from
Feb 1, 2016

Conversation

jbarnoud
Copy link
Contributor

@jbarnoud jbarnoud commented Feb 1, 2016

TRZ coordinate reader and writer are now compatible with python 3. A tests are added to make sure the title is read and write as expected. Also, the reader strips tailing spaces from short titles. Finally, the error massage raised by the writer when the title is too long is now friendlier.

Fix #689

See #260

Work around the merge of int and long int in python 3. Note that there
is no test for that work around as it would require a heavy TRZ file.
The length of the title in a TRZ file is limited to 80 characters.
TRZ titles shorter than 80 characters are read with trailing spaces.
These spaces are striped as they are not expected by the users.
seeksize = framesize * nframes
# On python 2, seek has issues with long int. This is solve in python 3
# where there is no longer a distinction between int and long int.
if six.PY2:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not tested as it would require a very large file. Any idea to test that without such a large file is welcome. If somebody as a large file to test this at least once, it may be worth to try.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see if I have one around for this..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And as for without a large file, I think technically we could mock up a fake file that returns byte offsets as if it were a large file or something... And then raised an Error if it was given a long int or something? I'll just check this manually I think :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess a Mock could do. But it would have to fail where an actual large file would fail, and it would have to capture how the behaviour differs among different versions of python. This would be tricky.

@richardjgowers richardjgowers self-assigned this Feb 1, 2016
@richardjgowers
Copy link
Member

Thanks for doing this, all looks good except comments

richardjgowers added a commit that referenced this pull request Feb 1, 2016
TRZ reader and writer are compatible with python 3
@richardjgowers richardjgowers merged commit ac8a98c into MDAnalysis:develop Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants