]> granicus.if.org Git - python/commitdiff
Add a few tests to test_count() to increase coverage in
authorWalter Dörwald <walter@livinglogic.de>
Mon, 10 Feb 2003 17:51:03 +0000 (17:51 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 10 Feb 2003 17:51:03 +0000 (17:51 +0000)
Object/unicodeobject.c::unicode_count().

Lib/test/test_unicode.py

index 1b78ddded8831da320d30e21a8df5d13649ee918..85c358669ee3a45bb53046b21d2ca9be6a1b46fd 100644 (file)
@@ -79,8 +79,14 @@ class UnicodeTest(unittest.TestCase):
         self.checkmethod('count', 'aaa', 0, u'b')
         self.checkmethod('count', u'aaa', 3, 'a')
         self.checkmethod('count', u'aaa', 0, 'b')
+        self.checkmethod('count', u'aaa', 0, 'b')
+        self.checkmethod('count', u'aaa', 1, 'a', -1)
+        self.checkmethod('count', u'aaa', 3, 'a', -10)
+        self.checkmethod('count', u'aaa', 2, 'a', 0, -1)
+        self.checkmethod('count', u'aaa', 0, 'a', 0, -10)
 
         self.assertRaises(TypeError, u'hello'.count)
+        self.assertRaises(TypeError, u'hello'.count, 42)
 
     def test_title(self):
         self.checkmethod('title', u' hello ', u' Hello ')