Back to index

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

List of all members.

Public Member Functions

def test_setdelitem
def test_inplace_repeat
def setUp
def test_index
def test_slice
def test_slice_bug7532
def test_repeat
def test_wrappers
def test_subclasses
def test_error

Public Attributes

 o
 n
 o2
 n2

Static Public Attributes

list seq = [0,10,20,30,40,50]

Detailed Description

Definition at line 129 of file test_index.py.


Member Function Documentation

def test.test_index.SeqTestCase.setUp (   self) [inherited]

Definition at line 62 of file test_index.py.

00062 
00063     def setUp(self):
00064         self.o = newstyle()
00065         self.n = newstyle()
00066         self.o2 = newstyle()
00067         self.n2 = newstyle()

Here is the caller graph for this function:

def test.test_index.SeqTestCase.test_error (   self) [inherited]

Definition at line 118 of file test_index.py.

00118 
00119     def test_error(self):
00120         self.o.ind = 'dumb'
00121         self.n.ind = 'bad'
00122         indexobj = lambda x, obj: obj.seq[x]
00123         self.assertRaises(TypeError, indexobj, self.o, self)
00124         self.assertRaises(TypeError, indexobj, self.n, self)
00125         sliceobj = lambda x, obj: obj.seq[x:]
00126         self.assertRaises(TypeError, sliceobj, self.o, self)
00127         self.assertRaises(TypeError, sliceobj, self.n, self)
00128 

Here is the call graph for this function:

def test.test_index.SeqTestCase.test_index (   self) [inherited]

Definition at line 68 of file test_index.py.

00068 
00069     def test_index(self):
00070         self.o.ind = -2
00071         self.n.ind = 2
00072         self.assertEqual(self.seq[self.n], self.seq[2])
00073         self.assertEqual(self.seq[self.o], self.seq[-2])

Here is the call graph for this function:

Definition at line 148 of file test_index.py.

00148 
00149     def test_inplace_repeat(self):
00150         self.o.ind = 2
00151         self.n.ind = 3
00152         lst = [6, 4]
00153         lst *= self.o
00154         self.assertEqual(lst, [6, 4, 6, 4])
00155         lst *= self.n
00156         self.assertEqual(lst, [6, 4, 6, 4] * 3)
00157 
00158         lst = [5, 6, 7, 8, 9, 11]
00159         l2 = lst.__imul__(self.n)
00160         self.assertIs(l2, lst)
00161         self.assertEqual(lst, [5, 6, 7, 8, 9, 11] * 3)
00162 

Here is the call graph for this function:

def test.test_index.SeqTestCase.test_repeat (   self) [inherited]

Definition at line 97 of file test_index.py.

00097 
00098     def test_repeat(self):
00099         self.o.ind = 3
00100         self.n.ind = 2
00101         self.assertEqual(self.seq * self.o, self.seq * 3)
00102         self.assertEqual(self.seq * self.n, self.seq * 2)
00103         self.assertEqual(self.o * self.seq, self.seq * 3)
00104         self.assertEqual(self.n * self.seq, self.seq * 2)

Here is the call graph for this function:

Definition at line 132 of file test_index.py.

00132 
00133     def test_setdelitem(self):
00134         self.o.ind = -2
00135         self.n.ind = 2
00136         lst = list('ab!cdefghi!j')
00137         del lst[self.o]
00138         del lst[self.n]
00139         lst[self.o] = 'X'
00140         lst[self.n] = 'Y'
00141         self.assertEqual(lst, list('abYdefghXj'))
00142 
00143         lst = [5, 6, 7, 8, 9, 10, 11]
00144         lst.__setitem__(self.n, "here")
00145         self.assertEqual(lst, [5, 6, "here", 8, 9, 10, 11])
00146         lst.__delitem__(self.n)
00147         self.assertEqual(lst, [5, 6, 8, 9, 10, 11])

Here is the call graph for this function:

def test.test_index.SeqTestCase.test_slice (   self) [inherited]

Definition at line 74 of file test_index.py.

00074 
00075     def test_slice(self):
00076         self.o.ind = 1
00077         self.o2.ind = 3
00078         self.n.ind = 2
00079         self.n2.ind = 4
00080         self.assertEqual(self.seq[self.o:self.o2], self.seq[1:3])
00081         self.assertEqual(self.seq[self.n:self.n2], self.seq[2:4])

Here is the call graph for this function:

Definition at line 82 of file test_index.py.

00082 
00083     def test_slice_bug7532(self):
00084         seqlen = len(self.seq)
00085         self.o.ind = int(seqlen * 1.5)
00086         self.n.ind = seqlen + 2
00087         self.assertEqual(self.seq[self.o:], self.seq[0:0])
00088         self.assertEqual(self.seq[:self.o], self.seq)
00089         self.assertEqual(self.seq[self.n:], self.seq[0:0])
00090         self.assertEqual(self.seq[:self.n], self.seq)
00091         self.o2.ind = -seqlen - 2
00092         self.n2.ind = -int(seqlen * 1.5)
00093         self.assertEqual(self.seq[self.o2:], self.seq)
00094         self.assertEqual(self.seq[:self.o2], self.seq[0:0])
00095         self.assertEqual(self.seq[self.n2:], self.seq)
00096         self.assertEqual(self.seq[:self.n2], self.seq[0:0])

Here is the call graph for this function:

def test.test_index.SeqTestCase.test_subclasses (   self) [inherited]

Definition at line 115 of file test_index.py.

00115 
00116     def test_subclasses(self):
00117         self.assertEqual(self.seq[TrapInt()], self.seq[0])

Here is the call graph for this function:

def test.test_index.SeqTestCase.test_wrappers (   self) [inherited]

Definition at line 105 of file test_index.py.

00105 
00106     def test_wrappers(self):
00107         self.o.ind = 4
00108         self.n.ind = 5
00109         self.assertEqual(self.seq.__getitem__(self.o), self.seq[4])
00110         self.assertEqual(self.seq.__mul__(self.o), self.seq * 4)
00111         self.assertEqual(self.seq.__rmul__(self.o), self.seq * 4)
00112         self.assertEqual(self.seq.__getitem__(self.n), self.seq[5])
00113         self.assertEqual(self.seq.__mul__(self.n), self.seq * 5)
00114         self.assertEqual(self.seq.__rmul__(self.n), self.seq * 5)

Here is the call graph for this function:


Member Data Documentation

Definition at line 64 of file test_index.py.

Definition at line 66 of file test_index.py.

Definition at line 63 of file test_index.py.

Definition at line 65 of file test_index.py.

list test.test_index.ListTestCase.seq = [0,10,20,30,40,50] [static]

Definition at line 130 of file test_index.py.


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