[issue11759] assert for exception parameters

Daniel Urban report at bugs.python.org
Mon Apr 4 11:27:10 CEST 2011


Daniel Urban <urban.dani+py at gmail.com> added the comment:

What about this:

>>> class MyTestCase(TestCase):
...     def test_foo(self):
...             with self.assertRaises(SyntaxError) as cm:
...                     compile('asdf jkl', 'file.py', 'eval')
...             self.assertEqual('file.py', cm.exception.filename)

This isn't good enough?

----------
nosy: +durban

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11759>
_______________________________________


More information about the Python-bugs-list mailing list