cpython: 775fb736b4b8 (original) (raw)
--- 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,))[](#l1.7)
with self.assertWarns(DeprecationWarning):[](#l1.8)
self.checkraises(TypeError, '%c', '__mod__', (None,))[](#l1.9) self.checkraises(ValueError, '%(foo', '__mod__', {})[](#l1.10) self.checkraises(TypeError, '%(foo)s %(bar)s', '__mod__', ('foo', 42))[](#l1.11) self.checkraises(TypeError, '%d', '__mod__', "42") # not numeric[](#l1.12)
--- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -142,7 +142,8 @@ class FormatTest(unittest.TestCase): testformat("%#+027.23X", big, "+0X0001234567890ABCDEF12345") # same, except no 0 flag testformat("%#+27.23X", big, " +0X001234567890ABCDEF12345")
testformat("%x", float(big), "123456_______________", 6)[](#l2.7)
with self.assertWarns(DeprecationWarning):[](#l2.8)
testformat("%x", float(big), "123456_______________", 6)[](#l2.9) big = 0o12345670123456701234567012345670 # 32 octal digits[](#l2.10) testformat("%o", big, "12345670123456701234567012345670")[](#l2.11) testformat("%o", -big, "-12345670123456701234567012345670")[](#l2.12)
@@ -182,7 +183,8 @@ class FormatTest(unittest.TestCase): testformat("%034.33o", big, "0012345670123456701234567012345670") # base marker shouldn't change that testformat("%0#34.33o", big, "0o012345670123456701234567012345670")
testformat("%o", float(big), "123456__________________________", 6)[](#l2.17)
with self.assertWarns(DeprecationWarning):[](#l2.18)
testformat("%o", float(big), "123456__________________________", 6)[](#l2.19) # Some small ints, in both Python int and flavors).[](#l2.20) testformat("%d", 42, "42")[](#l2.21) testformat("%d", -42, "-42")[](#l2.22)
@@ -193,7 +195,8 @@ class FormatTest(unittest.TestCase): testformat("%#x", 1, "0x1") testformat("%#X", 1, "0X1") testformat("%#X", 1, "0X1")
testformat("%#x", 1.0, "0x1")[](#l2.27)
with self.assertWarns(DeprecationWarning):[](#l2.28)
testformat("%#x", 1.0, "0x1")[](#l2.29) testformat("%#o", 1, "0o1")[](#l2.30) testformat("%#o", 1, "0o1")[](#l2.31) testformat("%#o", 0, "0o0")[](#l2.32)
@@ -210,12 +213,14 @@ class FormatTest(unittest.TestCase): testformat("%x", -0x42, "-42") testformat("%x", 0x42, "42") testformat("%x", -0x42, "-42")
testformat("%x", float(0x42), "42")[](#l2.37)
with self.assertWarns(DeprecationWarning):[](#l2.38)
testformat("%x", float(0x42), "42")[](#l2.39) testformat("%o", 0o42, "42")[](#l2.40) testformat("%o", -0o42, "-42")[](#l2.41) testformat("%o", 0o42, "42")[](#l2.42) testformat("%o", -0o42, "-42")[](#l2.43)
testformat("%o", float(0o42), "42")[](#l2.44)
with self.assertWarns(DeprecationWarning):[](#l2.45)
testformat("%o", float(0o42), "42")[](#l2.46) testformat("%r", "\u0378", "'\\u0378'") # non printable[](#l2.47) testformat("%a", "\u0378", "'\\u0378'") # non printable[](#l2.48) testformat("%r", "\u0374", "'\u0374'") # printable[](#l2.49)