R. David Murray added the comment:

with self.assertRaises(KeyError) as cm:
    os.environ[missing]
self.assertEqual(cm.excecption.args[0], missing)

(I don't know why assertRaises returns itself rather than just returning the 
exception in the with, but that's the API).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17702>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to