[Review Needed]Pytest Style core/test_atomgroup.py #1635
Merged
Conversation
def test_getitem_str(self): | ||
ag1 = self.universe.atoms['HT1'] | ||
dih_prec = 2 | ||
# def setUp(self): |
richardjgowers
Aug 21, 2017
Member
del
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) |
richardjgowers
Aug 21, 2017
Member
just use assert
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) |
richardjgowers
Aug 21, 2017
Member
assert
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) |
richardjgowers
Aug 21, 2017
Member
assert
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) |
richardjgowers
Aug 21, 2017
Member
assert
assert
ag.wrap(compound='atoms') | ||
|
||
assert_equal(self._in_box(ag.positions), True) | ||
assert_equal(self._in_box(ag.positions, u), True) |
richardjgowers
Aug 21, 2017
Member
assert
assert
assert_almost_equal, | ||
assert_equal, | ||
assert_array_almost_equal, | ||
assert_array_equal, |
richardjgowers
Aug 25, 2017
Member
we're not using assert_array_equal
we're not using assert_array_equal
utkbansal
Aug 26, 2017
Author
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. ])
@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. ])
kain88-de
Aug 27, 2017
Member
which test causes the dtype issue?
which test causes the dtype issue?
utkbansal
Sep 1, 2017
•
Author
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")
@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")
@richardjgowers can you have a look at the recent commit to remove |
@kain88-de lgtm if it passes |
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