Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_index.BaseTestCase Class Reference

List of all members.

Public Member Functions

def setUp
def test_basic
def test_slice
def test_wrappers
def test_subclasses
def test_error

Public Attributes

 o
 n

Detailed Description

Definition at line 14 of file test_index.py.


Member Function Documentation

Definition at line 15 of file test_index.py.

00015 
00016     def setUp(self):
00017         self.o = newstyle()
00018         self.n = newstyle()

Here is the caller graph for this function:

Definition at line 19 of file test_index.py.

00019 
00020     def test_basic(self):
00021         self.o.ind = -2
00022         self.n.ind = 2
00023         self.assertEqual(operator.index(self.o), -2)
00024         self.assertEqual(operator.index(self.n), 2)

Here is the call graph for this function:

Definition at line 50 of file test_index.py.

00050 
00051     def test_error(self):
00052         self.o.ind = 'dumb'
00053         self.n.ind = 'bad'
00054         self.assertRaises(TypeError, operator.index, self.o)
00055         self.assertRaises(TypeError, operator.index, self.n)
00056         self.assertRaises(TypeError, slice(self.o).indices, 0)
00057         self.assertRaises(TypeError, slice(self.n).indices, 0)
00058 

Here is the call graph for this function:

Definition at line 25 of file test_index.py.

00025 
00026     def test_slice(self):
00027         self.o.ind = 1
00028         self.n.ind = 2
00029         slc = slice(self.o, self.o, self.o)
00030         check_slc = slice(1, 1, 1)
00031         self.assertEqual(slc.indices(self.o), check_slc.indices(1))
00032         slc = slice(self.n, self.n, self.n)
00033         check_slc = slice(2, 2, 2)
00034         self.assertEqual(slc.indices(self.n), check_slc.indices(2))

Here is the call graph for this function:

Definition at line 45 of file test_index.py.

00045 
00046     def test_subclasses(self):
00047         r = list(range(10))
00048         self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10])
00049         self.assertEqual(slice(TrapInt()).indices(0), (0,0,1))

Here is the call graph for this function:

Definition at line 35 of file test_index.py.

00035 
00036     def test_wrappers(self):
00037         self.o.ind = 4
00038         self.n.ind = 5
00039         self.assertEqual(6 .__index__(), 6)
00040         self.assertEqual(-7 .__index__(), -7)
00041         self.assertEqual(self.o.__index__(), 4)
00042         self.assertEqual(self.n.__index__(), 5)
00043         self.assertEqual(True.__index__(), 1)
00044         self.assertEqual(False.__index__(), 0)

Here is the call graph for this function:


Member Data Documentation

Definition at line 17 of file test_index.py.

Definition at line 16 of file test_index.py.


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