Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_iterlen.TestSet Class Reference
Inheritance diagram for test.test_iterlen.TestSet:
Inheritance graph
[legend]
Collaboration diagram for test.test_iterlen.TestSet:
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 151 of file test_iterlen.py.


Member Function Documentation

Definition at line 153 of file test_iterlen.py.

00153 
00154     def setUp(self):
00155         d = set(range(n))
00156         self.it = iter(d)
00157         self.mutate = d.pop

Here is the call graph for this function:

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 155 of file test_iterlen.py.

Definition at line 156 of file test_iterlen.py.


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