Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61ecb77

Browse files
committed
Added the test cases I actually meant to add.
1 parent fc6e8fe commit 61ecb77

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_builtin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ def empty_format_spec(value):
562562
self.assertRaises(TypeError, format, object(), 4)
563563
self.assertRaises(TypeError, format, object(), object())
564564

565+
# first argument to object.__format__ must be string
566+
self.assertRaises(TypeError, object().__format__, 3)
567+
self.assertRaises(TypeError, object().__format__, object())
568+
self.assertRaises(TypeError, object().__format__, None)
569+
565570
# make sure we can take a subclass of str as a format spec
566571
self.assertEqual(format(0, C('10')), ' 0')
567572

0 commit comments

Comments
 (0)