unittest: AssertRaisesContext: Store exception value as self.exception.

For tests to check. This feature is used by CPython stdlib tests.
pull/488/head
Paul Sokolovsky 2019-07-27 07:14:45 +03:00 zatwierdzone przez Andrew Leech
rodzic 965e25ce89
commit a57b575020
1 zmienionych plików z 1 dodań i 0 usunięć

Wyświetl plik

@ -21,6 +21,7 @@ class AssertRaisesContext:
return self
def __exit__(self, exc_type, exc_value, tb):
self.exception = exc_value
if exc_type is None:
assert False, "%r not raised" % self.expected
if issubclass(exc_type, self.expected):