Make reversed() transparent with respect to length.

This commit is contained in:
Raymond Hettinger 2004-02-10 09:33:39 +00:00
parent 5cab2e3a88
commit 029dba5a40
2 changed files with 17 additions and 1 deletions

View file

@ -145,6 +145,10 @@ class TestReversed(unittest.TestCase):
s = 'hello'
self.assertEqual(list(reversed(reversed(s))), list(s))
def test_len(self):
s = 'hello'
self.assertEqual(len(reversed(s)), len(s))
def test_main(verbose=None):
testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
TestReversed)