Author rhettinger
Recipients Devin Jeanpierre, rhettinger
Date 2015-01-07.06:48:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420613306.0.0.433179586837.issue23086@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-01-07 06:48:26rhettingersetrecipients: + rhettinger, Devin Jeanpierre
2015-01-07 06:48:26rhettingersetmessageid: <1420613306.0.0.433179586837.issue23086@psf.upfronthosting.co.za>
2015-01-07 06:48:25rhettingerlinkissue23086 messages
2015-01-07 06:48:25rhettingercreate