X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_error.py;fp=tests%2Fbindings%2Fpython%2Fbt2%2Ftest_error.py;h=0bdd6ce3673a2c92c434299507bf6bd464307c77;hb=8258c4bd94a2ed6e3c23cd6c21c331b75d1ae52b;hp=821d30f5a25b485edfbc1b58c43d6b44f1cde620;hpb=e8cafc6e00a1de000a844a63091b42a0447cb21c;p=babeltrace.git diff --git a/tests/bindings/python/bt2/test_error.py b/tests/bindings/python/bt2/test_error.py index 821d30f5..0bdd6ce3 100644 --- a/tests/bindings/python/bt2/test_error.py +++ b/tests/bindings/python/bt2/test_error.py @@ -205,6 +205,15 @@ class ErrorTestCase(unittest.TestCase): self.assertEqual(cause.component_class_name, 'SourceWithFailingIter') self.assertIsNone(cause.plugin_name) + def test_str(self): + # Test __str__. We don't need to test the precise format used, but + # just that it doesn't miserably crash and that it contains some + # expected bits. + exc = self._run_failing_graph(SourceWithFailingIter, SinkWithExceptionChaining) + s = str(exc) + self.assertIn('[src (out): src.SourceWithFailingIter]', s) + self.assertIn('ValueError: oops', s) + if __name__ == '__main__': unittest.main()