Skip to content

Commit

Permalink
TST: test_spherical_zone() now redefined in test subclasses to proper…
Browse files Browse the repository at this point in the history
…ly handle regression in Issue #1795.
  • Loading branch information
tylerjereddy committed Mar 13, 2018
1 parent 2dcbf5c commit f14b7e7
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions testsuite/MDAnalysisTests/core/test_atomselections.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#
from __future__ import division, absolute_import

from six.moves import range
from six.moves import range, zip

import itertools
import numpy as np
Expand Down Expand Up @@ -542,20 +542,6 @@ def test_spherical_layer(self, u, meth, periodic):

assert ref == set(result.indices)

@pytest.mark.parametrize('input_val, expected',
zip(methods,
[25, 31, 33, 25,
55, 55, 55, 55]))
def test_spherical_zone(self, u, input_val, expected):
# NOTE: this has been modified to regression test
# only for resolution of Issue #1795
# pending proper pbc & wrapping implementations
# in the future
sel = Parser.parse('sphzone 5.0 resid 1', u.atoms)
sel = self.choosemeth(sel, input_val[0], input_val[1])
result = len(sel.apply(u.atoms))
assert result == expected

@pytest.mark.parametrize('meth, periodic', methods)
def test_point(self, u, meth, periodic):
sel = Parser.parse('point 5.0 5.0 5.0 3.0', u.atoms)
Expand Down Expand Up @@ -602,12 +588,38 @@ def test_cyzone(self, u, meth, periodic):

assert ref == set(result.indices)

@pytest.mark.parametrize('input_val, expected',
zip(BaseDistanceSelection.methods,
[25, 31, 33, 25]))
def test_spherical_zone(self, u, input_val, expected):
# NOTE: this has been modified to regression test
# only for resolution of Issue #1795
# pending proper pbc & wrapping implementations
# in the future
sel = Parser.parse('sphzone 5.0 resid 1', u.atoms)
sel = self.choosemeth(sel, input_val[0], input_val[1])
result = len(sel.apply(u.atoms))
assert result == expected


class TestTriclinicDistanceSelections(BaseDistanceSelection):
@pytest.fixture()
def u(self):
return mda.Universe(GRO)

@pytest.mark.parametrize('input_val, expected',
zip(BaseDistanceSelection.methods,
[55, 55, 55, 55]))
def test_spherical_zone(self, u, input_val, expected):
# NOTE: this has been modified to regression test
# only for resolution of Issue #1795
# pending proper pbc & wrapping implementations
# in the future
sel = Parser.parse('sphzone 5.0 resid 1', u.atoms)
sel = self.choosemeth(sel, input_val[0], input_val[1])
result = len(sel.apply(u.atoms))
assert result == expected


class TestTriclinicSelections(object):
"""Non-KDTree based selections
Expand Down

0 comments on commit f14b7e7

Please sign in to comment.