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

Pytest style analysis/test_distances.py #1541

Merged
merged 3 commits into from Jul 29, 2017

Conversation

Projects
None yet
3 participants
@utkbansal
Member

utkbansal commented Jul 23, 2017

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?
assert_equal(contacts.shape, self.shape,
"wrong shape (should be {0})".format(self.shape))
contacts = MDAnalysis.analysis.distances.contact_matrix(self.coord, cutoff=1, returntype="numpy")
assert contacts.shape == self.shape, "wrong shape (should be {0})".format(self.shape)

This comment has been minimized.

@kain88-de

kain88-de Jul 25, 2017

Member

This looks like you break the 80 char line limit. Also these tests look like they could be parametrized.

This comment has been minimized.

@utkbansal

utkbansal Jul 25, 2017

Member

@kain88-de All the 4 methods have different check in the assert_equal statement. If you want to parametrize, I'll have to send both the values that will be compared. I don't think that's a good idea.

This comment has been minimized.

@kain88-de

kain88-de Jul 25, 2017

Member

called np.asarray(...) on the contacts should also work for the sparse case

[1, 0, 1, 1, 1]], dtype=np.bool)
class TestContactMatrix(object):
coord = np.array([[1, 1, 1],

This comment has been minimized.

@richardjgowers

richardjgowers Jul 25, 2017

Member

The problem with declaring arrays in the class namespace like this is they can be accidentally modified by a test, and they will remain changed for all other tests (I think?)

del self.expected
class TestDist(object):
u = MDAnalysis.Universe(GRO)

This comment has been minimized.

@richardjgowers

richardjgowers Jul 25, 2017

Member

Same here, we shouldn't just be loading everything into the class namespace

@richardjgowers

Should use fixtures more

@richardjgowers richardjgowers self-assigned this Jul 25, 2017

@utkbansal

This comment has been minimized.

Member

utkbansal commented Jul 26, 2017

@richardjgowers Better now?

@utkbansal utkbansal changed the title from [WIP]Pytest style analysis/test_distances.py to Pytest style analysis/test_distances.py Jul 26, 2017

@kain88-de

This comment has been minimized.

Member

kain88-de commented Jul 26, 2017

@utkbansal the coverage went down with the latest changes

@utkbansal

This comment has been minimized.

Member

utkbansal commented Jul 27, 2017

@kain88-de I don't see how that happened, have restarted the build.

@utkbansal utkbansal referenced this pull request Jul 27, 2017

Merged

Pytest Style analysis/test_base.py #1547

0 of 4 tasks complete

@kain88-de kain88-de merged commit a46cf63 into MDAnalysis:develop Jul 29, 2017

2 of 3 checks passed

coverage/coveralls Coverage decreased (-0.03%) to 90.399%
Details
QuantifiedCode 8 minor issues introduced.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment