I'd like to test that a python 3 coro fails with a particular exception, but this functionality doesn't seem to be implemented.
async with self.assertRaises(TestExceptionType):
await my_func()
as the unit test fails like this:
...
File "/Users/...../tests.py", line 144, in go
async with self.assertRaises(TestExceptionType):
AttributeError: __aexit__
So my question is: should this work? And if not, what's the best way to assert a failing async function?
Aucun commentaire:
Enregistrer un commentaire