Catch deprecation warnings emitted when non-integers are formatted with %c, %o

and %x (introduced in issue #19995).
This commit is contained in:
Serhiy Storchaka 2014-02-06 22:44:27 +02:00
parent 303718c3d7
commit a146bef02b
2 changed files with 12 additions and 6 deletions

View file

@ -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