Let reversed() work with itself.

This commit is contained in:
Raymond Hettinger 2004-02-08 10:49:42 +00:00
parent 8a1a594590
commit 06353f76be
3 changed files with 17 additions and 1 deletions

View file

@ -141,6 +141,10 @@ class TestReversed(unittest.TestCase):
x = xrange(1)
self.assertEqual(type(reversed(x)), type(iter(x)))
def test_double_reverse(self):
s = 'hello'
self.assertEqual(list(reversed(reversed(s))), list(s))
def test_main(verbose=None):
testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
TestReversed)