]> granicus.if.org Git - python/commitdiff
Added the test cases I actually meant to add.
authorEric Smith <eric@trueblade.com>
Fri, 11 Jan 2008 00:32:16 +0000 (00:32 +0000)
committerEric Smith <eric@trueblade.com>
Fri, 11 Jan 2008 00:32:16 +0000 (00:32 +0000)
Lib/test/test_builtin.py

index c5bb54a52e91348268a2e6b5e2ee7d30029df8bb..b10caf511b8dd56225171230b7239567fd5a0eb8 100644 (file)
@@ -562,6 +562,11 @@ class BuiltinTest(unittest.TestCase):
         self.assertRaises(TypeError, format, object(), 4)
         self.assertRaises(TypeError, format, object(), object())
 
+        # first argument to object.__format__ must be string
+        self.assertRaises(TypeError, object().__format__, 3)
+        self.assertRaises(TypeError, object().__format__, object())
+        self.assertRaises(TypeError, object().__format__, None)
+
         # make sure we can take a subclass of str as a format spec
         self.assertEqual(format(0, C('10')), '         0')