Skip to content
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

utkbansal
Copy link
Member

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

ag.wrap(compound='group')

cen = ag.center_of_mass()

assert_equal(self._in_box(cen), True)
assert_equal(self._in_box(cen, u), True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

ag.wrap(compound='atoms')

assert_equal(self._in_box(ag.positions), True)
assert_equal(self._in_box(ag.positions, u), True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert

assert_almost_equal,
assert_equal,
assert_array_almost_equal,
assert_array_equal,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not using assert_array_equal

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.       ])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which test causes the dtype issue?

Copy link
Member Author

@utkbansal utkbansal Sep 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Member

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

@richardjgowers
Copy link
Member

@kain88-de lgtm if it passes

@kain88-de kain88-de merged commit b138532 into MDAnalysis:develop Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants