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

[Review Needed]Pytest Style core/test_atomgroup.py #1635

Merged
merged 3 commits into from Sep 5, 2017

Conversation

Projects
None yet
3 participants
@utkbansal
Member

utkbansal commented Aug 20, 2017

Fixes #

Changes made in this Pull Request:

PR Checklist

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

@richardjgowers richardjgowers self-assigned this Aug 21, 2017

def test_getitem_str(self):
ag1 = self.universe.atoms['HT1']
dih_prec = 2
# def setUp(self):

This comment has been minimized.

@richardjgowers
ag.wrap(compound='fragments')
cen = np.vstack([f.center_of_mass() for f in ag.fragments])
assert_equal(self._in_box(cen), True)
assert_equal(self._in_box(cen, u), True)

This comment has been minimized.

@richardjgowers

richardjgowers Aug 21, 2017

Member

just use assert

ag.wrap(compound='segments')
cen = np.vstack([s.atoms.center_of_mass() for s in ag.segments])
assert_equal(self._in_box(cen), True)
assert_equal(self._in_box(cen, u), True)

This comment has been minimized.

@richardjgowers
ag.wrap(compound='residues')
cen = np.vstack([r.atoms.center_of_mass() for r in ag.residues])
assert_equal(self._in_box(cen), True)
assert_equal(self._in_box(cen, u), True)

This comment has been minimized.

@richardjgowers
ag.wrap(compound='group')
cen = ag.center_of_mass()
assert_equal(self._in_box(cen), True)
assert_equal(self._in_box(cen, u), True)

This comment has been minimized.

@richardjgowers
ag.wrap(compound='atoms')
assert_equal(self._in_box(ag.positions), True)
assert_equal(self._in_box(ag.positions, u), True)

This comment has been minimized.

@richardjgowers
assert_almost_equal,
assert_equal,
assert_array_almost_equal,
assert_array_equal,

This comment has been minimized.

@richardjgowers

richardjgowers Aug 25, 2017

Member

we're not using assert_array_equal

This comment has been minimized.

@utkbansal

utkbansal Aug 26, 2017

Member

@richardjgowers The dtype causes a mismatch in this case. How do I work around it?

E           AssertionError: 
E           Arrays are not almost equal to 7 decimals
E           
E           (mismatch 33.3333333333%)
E            x: array([ 2.6028271, -1.1962211,  0.       ], dtype=float32)
E            y: array([ 2.6028272, -1.1962211,  0.       ])

This comment has been minimized.

@kain88-de

kain88-de Aug 27, 2017

Member

which test causes the dtype issue?

This comment has been minimized.

@utkbansal

utkbansal Sep 1, 2017

Member

@richardjgowers @kain88-de In class TestAtomGroup

    def test_index_slice_empty(self, universe):
        u = universe
        assert_equal(u.atoms[0:0], [],
                           "making an empty AtomGroup failed")
@kain88-de

This comment has been minimized.

Member

kain88-de commented Sep 4, 2017

@richardjgowers can you have a look at the recent commit to remove assert_array_*. Thanks.

@richardjgowers

This comment has been minimized.

Member

richardjgowers commented Sep 5, 2017

@kain88-de lgtm if it passes

@kain88-de kain88-de merged commit b138532 into MDAnalysis:develop Sep 5, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 90.596%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment