Raise TypeError for with raises(..., match=<non-None falsey value>).

This commit is contained in:
Anthony Sottile
2018-12-12 14:58:48 -08:00
parent 6af674a3ac
commit a254ad0436
3 changed files with 7 additions and 1 deletions

View File

@@ -716,6 +716,6 @@ class RaisesContext(object):
suppress_exception = issubclass(self.excinfo.type, self.expected_exception)
if sys.version_info[0] == 2 and suppress_exception:
sys.exc_clear()
if self.match_expr and suppress_exception:
if self.match_expr is not None and suppress_exception:
self.excinfo.match(self.match_expr)
return suppress_exception