Skip to content
Browse files

Use numpy testing array equals

  • Loading branch information...
hirschsn committed Apr 15, 2019
1 parent bad1057 commit c546e1a1eb30944a74c89d8f9e5dc8862a3e7931
Showing with 3 additions and 14 deletions.
  1. +3 −14 testsuite/python/
@@ -103,17 +103,6 @@ def setUp(self):
def tearDown(self):

def assertAllEqual(self, v, w):
"""AssertEqual for arrays and more. Checks assertEqual() for all
corresponding elements."""
if isinstance(v, numpy.ndarray) and isinstance(w, numpy.ndarray):
self.assertTupleEqual(v.shape, w.shape)
self.assertEqual(len(v), len(w))

for a, b in zip(v, w):
self.assertEqual(a, b)

def check_files_exist(self):
"""Checks if all necessary files have been written."""
for fn in filenames:
@@ -125,15 +114,15 @@ def check_sample_system(self):
for p, q in zip(self.s.part, self.test_particles):
self.assertEqual(p.type, q.type)
self.assertAllEqual(p.pos, q.pos)
self.assertAllEqual(p.v, q.v)
numpy.testing.assert_array_equal(p.pos, q.pos)
numpy.testing.assert_array_equal(p.v, q.v)
self.assertEqual(len(p.bonds), len(q.bonds))
# Check all bonds
for bp, bq in zip(p.bonds, q.bonds):
# Bond type - "bend" stores the index of the bond
self.assertEqual(bp[0].params["bend"], bq[0])
# Bond partners
self.assertAllEqual(bp[1:], bq[1:])
numpy.testing.assert_array_equal(bp[1:], bq[1:])

def test_mpiio(self):

0 comments on commit c546e1a

Please sign in to comment.
You can’t perform that action at this time.