Add a few tests to test_count() to increase coverage in

Object/unicodeobject.c::unicode_count().
This commit is contained in:
Walter Dörwald 2003-02-10 17:51:03 +00:00
parent 74640247d4
commit 4f046e2e21
1 changed files with 6 additions and 0 deletions

View File

@ -79,8 +79,14 @@ class UnicodeTest(unittest.TestCase):
self.checkmethod('count', 'aaa', 0, u'b') self.checkmethod('count', 'aaa', 0, u'b')
self.checkmethod('count', u'aaa', 3, 'a') 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', 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)
self.assertRaises(TypeError, u'hello'.count, 42)
def test_title(self): def test_title(self):
self.checkmethod('title', u' hello ', u' Hello ') self.checkmethod('title', u' hello ', u' Hello ')