mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (GH-8623)
This commit is contained in:
parent
e349bf2358
commit
77d5781835
3 changed files with 17 additions and 19 deletions
|
@ -157,16 +157,11 @@ class _AssertRaisesBaseContext(_BaseTestCaseContext):
|
|||
if not _is_subtype(self.expected, self._base_type):
|
||||
raise TypeError('%s() arg 1 must be %s' %
|
||||
(name, self._base_type_str))
|
||||
if args and args[0] is None:
|
||||
warnings.warn("callable is None",
|
||||
DeprecationWarning, 3)
|
||||
args = ()
|
||||
if not args:
|
||||
self.msg = kwargs.pop('msg', None)
|
||||
if kwargs:
|
||||
warnings.warn('%r is an invalid keyword argument for '
|
||||
'this function' % next(iter(kwargs)),
|
||||
DeprecationWarning, 3)
|
||||
raise TypeError('%r is an invalid keyword argument for '
|
||||
'this function' % (next(iter(kwargs)),))
|
||||
return self
|
||||
|
||||
callable_obj, *args = args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue