Ezio Melotti added the comment:
I missed the initial patch. What I was thinking about was to use simply
with self.assertRaises(TypeError):
self.assertRaises(1)
instead of:
+ ctx = self.assertRaises(TypeError)
+ with ctx:
+ self.assertRaises(1)
+ self.assertIsInstance(ctx.exception, TypeError)
or
+ try:
+ self.assertRaises(1)
+ self.fail("Expected TypeError")
+ except TypeError:
+ pass
Unless I'm missing something, all these should be equivalent.
You could even use assertRaisesRegex to check the error message if you think
that's appropriate.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15836>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com