def test_rindex(self, size):
        SUBSTR = ' abc def ghi'
        sublen = len(SUBSTR)
        s = ''.join([SUBSTR, '-' * size, SUBSTR])
        self.assertEquals(s.rindex(' '),
                          sublen + size + SUBSTR.rindex(' '))
        self.assertEquals(s.rindex(SUBSTR), sublen + size)
        self.assertEquals(s.rindex(' ', 0, sublen + size - 1),
                          SUBSTR.rindex(' '))
        self.assertEquals(s.rindex(SUBSTR, 0, sublen + size), 0)
        self.assertEquals(s.rindex('i'),
                          sublen + size + SUBSTR.rindex('i'))
        self.assertEquals(s.rindex('i', 0, sublen), SUBSTR.rindex('i'))
        self.assertEquals(s.rindex('i', 0, sublen + size),
                          SUBSTR.rindex('i'))
        self.assertRaises(ValueError, s.rindex, 'j')