[WIP]Pytest Style analysis/test_contacts.py #1545
Merged
Conversation
assert contacts.hard_cut_q([2], 1) == 0 | ||
assert contacts.hard_cut_q([2, 0.5], 1) == 0.5 | ||
assert contacts.hard_cut_q([2, 3], [3, 4]) == 1 | ||
assert contacts.hard_cut_q([4, 5], [3, 4]) == 0 |
kain88-de
Jul 24, 2017
Member
Parametrize
Parametrize
assert_equal(contacts.radius_cut_q([2], None, 1), 0) | ||
assert_equal(contacts.radius_cut_q([2, 0.5], None, 1), 0.5) | ||
assert contacts.radius_cut_q([1], None, 2) == 1 | ||
assert contacts.radius_cut_q([2], None, 1) == 0 |
kain88-de
Jul 24, 2017
Member
Parametrize
Parametrize
|
||
from MDAnalysisTests import tempdir | ||
|
||
|
||
def test_soft_cut_q(): | ||
# just check some of the extremal points | ||
assert_equal(contacts.soft_cut_q([0], [0]), .5) | ||
assert contacts.soft_cut_q([0], [0]) == .5 | ||
assert_almost_equal(contacts.soft_cut_q([100], [0]), 0) | ||
assert_almost_equal(contacts.soft_cut_q([-100], [0]), 1) |
kain88-de
Jul 24, 2017
Member
Parametrize
Parametrize
utkbansal
Jul 25, 2017
Author
Member
@kain88-de Should I break this into two functions? One with assert
and another with assert_almost_equal
which would be parametrized?
@kain88-de Should I break this into two functions? One with assert
and another with assert_almost_equal
which would be parametrized?
kain88-de
Jul 25, 2017
Member
they can all use assert_almost_equal
they can all use assert_almost_equal
@staticmethod | ||
@pytest.fixture() | ||
def trajectory(universe): | ||
return universe.trajectory |
kain88-de
Jul 24, 2017
Member
No fixture needed
No fixture needed
def _run_Contacts(self, **kwargs): | ||
acidic = self.universe.select_atoms(self.sel_acidic) | ||
basic = self.universe.select_atoms(self.sel_basic) | ||
def _run_Contacts(self, universe, **kwargs): |
kain88-de
Jul 24, 2017
Member
This should rather be a fixture
This should rather be a fixture
utkbansal
Jul 25, 2017
Author
Member
Not sure how I'd pass it **kwargs
then.
Not sure how I'd pass it **kwargs
then.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Fixes #
Changes made in this Pull Request:
PR Checklist