Backport 69934: Register xrange() as a Sequence.
This commit is contained in:
parent
54fba82310
commit
9293eb965a
|
@ -519,6 +519,7 @@ class Sequence(Sized, Iterable, Container):
|
|||
Sequence.register(tuple)
|
||||
Sequence.register(basestring)
|
||||
Sequence.register(buffer)
|
||||
Sequence.register(xrange)
|
||||
|
||||
|
||||
class MutableSequence(Sequence):
|
||||
|
|
|
@ -393,6 +393,9 @@ class TestCollectionABCs(ABCTestCase):
|
|||
self.failUnless(isinstance(sample(), Sequence))
|
||||
self.failUnless(issubclass(sample, Sequence))
|
||||
self.failUnless(issubclass(basestring, Sequence))
|
||||
self.failUnless(isinstance(range(10), Sequence))
|
||||
self.failUnless(issubclass(xrange, Sequence))
|
||||
self.failUnless(issubclass(str, Sequence))
|
||||
self.validate_abstract_methods(Sequence, '__contains__', '__iter__', '__len__',
|
||||
'__getitem__')
|
||||
|
||||
|
|
Loading…
Reference in New Issue