diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-06 20:44:27 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-06 20:44:27 (GMT) |
commit | a146bef02bf26b75d8d720f444283e28e784a1e3 (patch) | |
tree | 4136d8aaae59bddf6030f359ed80f4a9b5221157 /Lib/test/string_tests.py | |
parent | 303718c3d7b650f946a6364f50c9048a1100535b (diff) | |
download | cpython-a146bef02bf26b75d8d720f444283e28e784a1e3.zip cpython-a146bef02bf26b75d8d720f444283e28e784a1e3.tar.gz cpython-a146bef02bf26b75d8d720f444283e28e784a1e3.tar.bz2 |
Catch deprecation warnings emitted when non-integers are formatted with %c, %o
and %x (introduced in issue #19995).
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index ef995e2..4345687 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 |