Issue19995: passing a non-int to %o, %c, %x, or %X now raises an exception

This commit is contained in:
Ethan Furman 2014-03-19 08:38:52 -07:00
parent 8e5d0caf92
commit 38d872ee5d
5 changed files with 10 additions and 43 deletions

View file

@ -1178,8 +1178,7 @@ class MixinStrUnicodeUserStringTest:
self.checkraises(TypeError, 'abc', '__mod__')
self.checkraises(TypeError, '%(foo)s', '__mod__', 42)
self.checkraises(TypeError, '%s%s', '__mod__', (42,))
with self.assertWarns(DeprecationWarning):
self.checkraises(TypeError, '%c', '__mod__', (None,))
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