From a146bef02bf26b75d8d720f444283e28e784a1e3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 6 Feb 2014 22:44:27 +0200 Subject: Catch deprecation warnings emitted when non-integers are formatted with %c, %o and %x (introduced in issue #19995). --- Lib/test/string_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/test/string_tests.py') diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index ef995e202b..4345687ea1 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -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 -- cgit v1.2.1