Skip to content

Commit

Permalink
Show objects when assertions fail
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed May 6, 2014
1 parent ec89f15 commit d876a38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def assertVariableIdentical(self, v1, v2):

def assertVariableAllClose(self, v1, v2, rtol=1e-05, atol=1e-08):
self.assertEqual(v1.dimensions, v2.dimensions)
self.assertTrue(data_allclose_or_equiv(v1.values, v2.values,
rtol=rtol, atol=atol))
assert data_allclose_or_equiv(v1.values, v2.values, rtol=rtol, atol=atol),\
(repr(v1.values), repr(v2.values))

def assertVariableNotEqual(self, v1, v2):
self.assertFalse(as_variable(v1).equals(v2))
Expand All @@ -81,7 +81,7 @@ def assertDatasetIdentical(self, d1, d2):
for k in d1:
v1 = d1.variables[k]
v2 = d2.variables[k]
self.assertTrue(v1.identical(v2))
assert v1.identical(v2), (v1, v2)

def assertDatasetAllClose(self, d1, d2, rtol=1e-05, atol=1e-08):
self.assertEqual(sorted(d1.variables), sorted(d2.variables))
Expand Down
2 changes: 1 addition & 1 deletion test/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def test_to_and_from_dataframe(self):
index=pd.Index(t, name='t'))
actual = ds.to_dataframe()
# use the .equals method to check all DataFrame metadata
self.assertTrue(expected.equals(actual))
assert expected.equals(actual), (expected, actual)

# check roundtrip
self.assertDatasetIdentical(ds, Dataset.from_dataframe(actual))
Expand Down

0 comments on commit d876a38

Please sign in to comment.