def when_called_with(self, *some_args, **some_kwargs):
if not self.expected:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>self.val(*some_args, **some_kwargs)<EOL><DEDENT>except BaseException as e:<EOL><INDENT>if issubclass(type(e), self.expected):<EOL><INDENT>return AssertionBuilder(str(e), self.description, self.kind)<EOL><DEDENT>else:<EOL><INDENT>self._err('<STR_LIT>' % (<EOL>self.val.__name__,<EOL>self.expected.__name__,<EOL>self._fmt_args_kwargs(*some_args, **some_kwargs),<EOL>type(e).__name__))<EOL><DEDENT><DEDENT>self._err('<STR_LIT>' % (<EOL>self.val.__name__,<EOL>self.expected.__name__,<EOL>self._fmt_args_kwargs(*some_args, **some_kwargs)))<EOL>
Asserts the val callable when invoked with the given args and kwargs raises the expected exception.