Back to index

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

List of all members.

Public Member Functions

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

string seq = "this is a test"

Detailed Description

Definition at line 194 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:

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:

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.

Definition at line 195 of file test_index.py.


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