mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Catch deprecation warnings emitted when non-integers are formatted with %c, %o
and %x (introduced in issue #19995).
This commit is contained in:
parent
303718c3d7
commit
a146bef02b
2 changed files with 12 additions and 6 deletions
|
@ -1179,7 +1179,8 @@ class MixinStrUnicodeUserStringTest:
|
|||
self.checkraises(TypeError, 'abc', '__mod__')
|
||||
self.checkraises(TypeError, '%(foo)s', '__mod__', 42)
|
||||
self.checkraises(TypeError, '%s%s', '__mod__', (42,))
|
||||
self.checkraises(TypeError, '%c', '__mod__', (None,))
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
self.checkraises(TypeError, '%c', '__mod__', (None,))
|
||||
self.checkraises(ValueError, '%(foo', '__mod__', {})
|
||||
self.checkraises(TypeError, '%(foo)s %(bar)s', '__mod__', ('foo', 42))
|
||||
self.checkraises(TypeError, '%d', '__mod__', "42") # not numeric
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue