def METHOD_NAME(self):
    class TestException(Exception):
        pass
    with self.assertRaises(TestException):
        with self.obj as chan:
            self.assertFalse(chan._impl.close.called)
            raise TestException()
    chan._impl.close.assert_called_once_with(
        reply_code=0, reply_text='Normal shutdown')