Skip to content

[Review Needed]Pytest Style topology/test_gro.py #1590

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

Merged
merged 3 commits into from
Aug 15, 2017

Conversation

utkbansal
Copy link
Member

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

Copy link
Contributor

@jbarnoud jbarnoud left a comment

Choose a reason for hiding this comment

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

One more file about to bite the dust. A few things to fix, though.

@@ -54,11 +48,11 @@ class TestGROParser(ParserBase):

def test_attr_size(self, top):
for attr in ['ids', 'names']:
Copy link
Contributor

Choose a reason for hiding this comment

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

The loops are meaningless: the attr variable is not used.

resids = [1, 99999, 100000, 100001, 199999, 200000, 200001]

assert_(top.tt.size == (126, 7, 1))
assert top.tt.size == (126, 7, 1)
for i, (r, n, l) in enumerate(zip(resids, self.names, self.lengths)):
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably can compare the full arrays rather than comparing element per element.

def test_sameresid_diffresname(args):
i = args[0]
resid = args[1][0]
resname = args[1][1]
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be clearer written like: i, (resid, resname) = args.


def test_sameresid_diffresname():
@pytest.mark.parametrize(
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't really need to be parametrized, it all tests the same thing, rather than different cases of something

@jbarnoud jbarnoud merged commit 69730f4 into MDAnalysis:develop Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants