Back to index

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

List of all members.

Public Member Functions

def test_basicfunction
def test_getitemseqn
def test_iteratorseqn
def test_iteratorgenerator
def test_noniterable
def test_illformediterable
def test_exception_propagation
def test_argumentcheck
def test_tuple_reuse

Static Public Attributes

tuple seq = range(10,20000,2)
tuple res = list(zip(range(20000), seq))
 enum = enumerate

Detailed Description

Definition at line 124 of file test_enumerate.py.


Member Function Documentation

Definition at line 100 of file test_enumerate.py.

00100 
00101     def test_argumentcheck(self):
00102         self.assertRaises(TypeError, self.enum) # no arguments
00103         self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable)
00104         self.assertRaises(TypeError, self.enum, 'abc', 'a') # wrong type
00105         self.assertRaises(TypeError, self.enum, 'abc', 2, 3) # too many arguments

Here is the call graph for this function:

Reimplemented in test.test_enumerate.EnumerateStartTestCase.

Definition at line 69 of file test_enumerate.py.

00069 
00070     def test_basicfunction(self):
00071         self.assertEqual(type(self.enum(self.seq)), self.enum)
00072         e = self.enum(self.seq)
00073         self.assertEqual(iter(e), e)
00074         self.assertEqual(list(self.enum(self.seq)), self.res)
00075         self.enum.__doc__

Here is the call graph for this function:

Definition at line 97 of file test_enumerate.py.

00097 
00098     def test_exception_propagation(self):
00099         self.assertRaises(ZeroDivisionError, list, self.enum(E(self.seq)))

Here is the call graph for this function:

Definition at line 76 of file test_enumerate.py.

00076 
00077     def test_getitemseqn(self):
00078         self.assertEqual(list(self.enum(G(self.seq))), self.res)
00079         e = self.enum(G(''))
00080         self.assertRaises(StopIteration, next, e)

Here is the call graph for this function:

Definition at line 94 of file test_enumerate.py.

00094 
00095     def test_illformediterable(self):
00096         self.assertRaises(TypeError, self.enum, N(self.seq))

Here is the call graph for this function:

Definition at line 86 of file test_enumerate.py.

00086 
00087     def test_iteratorgenerator(self):
00088         self.assertEqual(list(self.enum(Ig(self.seq))), self.res)
00089         e = self.enum(Ig(''))
00090         self.assertRaises(StopIteration, next, e)

Here is the call graph for this function:

Definition at line 81 of file test_enumerate.py.

00081 
00082     def test_iteratorseqn(self):
00083         self.assertEqual(list(self.enum(I(self.seq))), self.res)
00084         e = self.enum(I(''))
00085         self.assertRaises(StopIteration, next, e)

Here is the call graph for this function:

Definition at line 91 of file test_enumerate.py.

00091 
00092     def test_noniterable(self):
00093         self.assertRaises(TypeError, self.enum, X(self.seq))

Here is the call graph for this function:

Definition at line 107 of file test_enumerate.py.

00107 
00108     def test_tuple_reuse(self):
00109         # Tests an implementation detail where tuple is reused
00110         # whenever nothing else holds a reference to it
00111         self.assertEqual(len(set(map(id, list(enumerate(self.seq))))), len(self.seq))
00112         self.assertEqual(len(set(map(id, enumerate(self.seq)))), min(1,len(self.seq)))

Here is the call graph for this function:


Member Data Documentation

test.test_enumerate.EnumerateTestCase.enum = enumerate [static, inherited]
tuple test.test_enumerate.TestBig.res = list(zip(range(20000), seq)) [static]

Definition at line 127 of file test_enumerate.py.

tuple test.test_enumerate.TestBig.seq = range(10,20000,2) [static]

Definition at line 126 of file test_enumerate.py.


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