Back to index

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

List of all members.

Public Member Functions

def setUp
def test_immutable_during_iteration
def test_invariant

Public Attributes

 it
 mutate

Detailed Description

Definition at line 123 of file test_iterlen.py.


Member Function Documentation

Definition at line 125 of file test_iterlen.py.

00125 
00126     def setUp(self):
00127         d = deque(range(n))
00128         self.it = reversed(d)
00129         self.mutate = d.pop

Here is the caller graph for this function:

Definition at line 76 of file test_iterlen.py.

00076 
00077     def test_immutable_during_iteration(self):
00078         # objects such as deques, sets, and dictionaries enforce
00079         # length immutability  during iteration
00080 
00081         it = self.it
00082         self.assertEqual(len(it), n)
00083         next(it)
00084         self.assertEqual(len(it), n-1)
00085         self.mutate()
00086         self.assertRaises(RuntimeError, next, it)
00087         self.assertEqual(len(it), 0)

Here is the call 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:


Member Data Documentation

Definition at line 127 of file test_iterlen.py.

Definition at line 128 of file test_iterlen.py.


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