Raymond Hettinger added the comment: This test looks like it may have been a typo:
self.assertEqual(seq.index('a'), 0, 1) Also, it would be nice to investigate the differences with list.index() and str.index() for the corner cases. Something along these lines: # Compare Sequence.index() behavior to list.index() behavior listseq = list('abracadabra') seqseq = SequenceSubclass(listseq) for start in range(-3, len(listseq) + 3): for stop in range(-3, len(listseq) + 3): for letter in set(listseq + ['z']): try: expected = listseq.index(letter, start, stop) except ValueError: with self.assertRaises(ValueError): seqseq.index(letter, start, stop) else: actual = seqseq.index(letter, start, stop) self.assertEqual(actual, expected, (letter, start, stop)) # Compare Sequence.index() behavior to str.index() behavior strseq = 'abracadabra' seqseq = SequenceSubclass(strseq) for start in range(-3, len(strseq) + 3): for stop in range(-3, len(strseq) + 3): for letter in set(strseq + 'z'): try: expected = strseq.index(letter, start, stop) except ValueError: with self.assertRaises(ValueError): seqseq.index(letter, start, stop) else: actual = seqseq.index(letter, start, stop) self.assertEqual(actual, expected, (letter, start, stop) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23086> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com