Back to index

python3.2  3.2.2
Classes | Public Member Functions
test.test_with.NestedWith Class Reference

List of all members.

Classes

class  Dummy
class  EnterRaises
class  ExitRaises
class  InitRaises

Public Member Functions

def testNoExceptions
def testExceptionInExprList
def testExceptionInEnter
def testExceptionInExit
def testEnterReturnsTuple

Detailed Description

Definition at line 666 of file test_with.py.


Member Function Documentation

Definition at line 734 of file test_with.py.

00734 
00735     def testEnterReturnsTuple(self):
00736         with self.Dummy(value=(1,2)) as (a1, a2), \
00737              self.Dummy(value=(10, 20)) as (b1, b2):
00738             self.assertEqual(1, a1)
00739             self.assertEqual(2, a2)
00740             self.assertEqual(10, b1)
00741             self.assertEqual(20, b2)

Here is the call graph for this function:

Definition at line 714 of file test_with.py.

00714 
00715     def testExceptionInEnter(self):
00716         try:
00717             with self.Dummy() as a, self.EnterRaises():
00718                 self.fail('body of bad with executed')
00719         except RuntimeError:
00720             pass
00721         else:
00722             self.fail('RuntimeError not reraised')
00723         self.assertTrue(a.enter_called)
00724         self.assertTrue(a.exit_called)

Here is the call graph for this function:

Definition at line 725 of file test_with.py.

00725 
00726     def testExceptionInExit(self):
00727         body_executed = False
00728         with self.Dummy(gobble=True) as a, self.ExitRaises():
00729             body_executed = True
00730         self.assertTrue(a.enter_called)
00731         self.assertTrue(a.exit_called)
00732         self.assertTrue(body_executed)
00733         self.assertNotEqual(a.exc_info[0], None)

Here is the call graph for this function:

Definition at line 705 of file test_with.py.

00705 
00706     def testExceptionInExprList(self):
00707         try:
00708             with self.Dummy() as a, self.InitRaises():
00709                 pass
00710         except:
00711             pass
00712         self.assertTrue(a.enter_called)
00713         self.assertTrue(a.exit_called)

Here is the call graph for this function:

Definition at line 698 of file test_with.py.

00698 
00699     def testNoExceptions(self):
00700         with self.Dummy() as a, self.Dummy() as b:
00701             self.assertTrue(a.enter_called)
00702             self.assertTrue(b.enter_called)
00703         self.assertTrue(a.exit_called)
00704         self.assertTrue(b.exit_called)

Here is the call graph for this function:


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