Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_iterlen.TestListReversed Class Reference
Inheritance diagram for test.test_iterlen.TestListReversed:
Inheritance graph
[legend]
Collaboration diagram for test.test_iterlen.TestListReversed:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def test_mutation
def test_invariant

Public Attributes

 it

Detailed Description

Definition at line 179 of file test_iterlen.py.


Member Function Documentation

Definition at line 181 of file test_iterlen.py.

00181 
00182     def setUp(self):
00183         self.it = reversed(range(n))

Here is the caller graph for this function:

Definition at line 65 of file test_iterlen.py.

00065 
00066     def test_invariant(self):
00067         it = self.it
00068         for i in reversed(range(1, n+1)):
00069             self.assertEqual(len(it), i)
00070             next(it)
00071         self.assertEqual(len(it), 0)
00072         self.assertRaises(StopIteration, next, it)
00073         self.assertEqual(len(it), 0)

Here is the call graph for this function:

Definition at line 184 of file test_iterlen.py.

00184 
00185     def test_mutation(self):
00186         d = list(range(n))
00187         it = reversed(d)
00188         next(it)
00189         next(it)
00190         self.assertEqual(len(it), n-2)
00191         d.append(n)
00192         self.assertEqual(len(it), n-2)  # ignore append
00193         d[1:] = []
00194         self.assertEqual(len(it), 0)
00195         self.assertEqual(list(it), [])  # confirm invariant
00196         d.extend(range(20))
00197         self.assertEqual(len(it), 0)

Here is the call graph for this function:


Member Data Documentation

Definition at line 182 of file test_iterlen.py.


The documentation for this class was generated from the following file: