Skip to content

Commit

Permalink
fixed test supplying integer as atom name
Browse files Browse the repository at this point in the history
really topologyattrs need to be statically typed and protective about this
  • Loading branch information
richardjgowers committed Jun 16, 2020
1 parent afca007 commit 97e1782
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion testsuite/MDAnalysisTests/core/test_topologyattrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class TestAtomAttr(TopologyAttrMixin):
"""
values = np.array([7, 3, 69, 9993, 84, 194, 263, 501, 109, 5873])
single_value = 567
attrclass = tpattrs.AtomAttr

def test_set_atom_VE(self):
Expand All @@ -110,7 +111,7 @@ def test_get_atoms(self, attr):
def test_set_atoms_singular(self, attr):
# set len 2 Group to len 1 value
dg = DummyGroup([3, 7])
attr.set_atoms(dg, 567)
attr.set_atoms(dg, self.single_value)
assert_equal(attr.get_atoms(dg), np.array([567, 567]))

def test_set_atoms_plural(self, attr):
Expand Down Expand Up @@ -173,6 +174,7 @@ def test_cant_set_segment_indices(self, u):
class TestAtomnames(TestAtomAttr):
values = np.array(['O', 'C', 'CA', 'N', 'CB', 'CG', 'CD', 'NA', 'CL', 'OW'],
dtype=np.object)
single_value = 'Ca2'
attrclass = tpattrs.Atomnames


Expand Down

0 comments on commit 97e1782

Please sign in to comment.