Back to index

python3.2  3.2.2
Public Member Functions
test.test_contextlib.ClosingTestCase Class Reference

List of all members.

Public Member Functions

def test_closing
def test_closing_error

Detailed Description

Definition at line 109 of file test_contextlib.py.


Member Function Documentation

Definition at line 113 of file test_contextlib.py.

00113 
00114     def test_closing(self):
00115         state = []
00116         class C:
00117             def close(self):
00118                 state.append(1)
00119         x = C()
00120         self.assertEqual(state, [])
00121         with closing(x) as y:
00122             self.assertEqual(x, y)
00123         self.assertEqual(state, [1])

Here is the call graph for this function:

Definition at line 124 of file test_contextlib.py.

00124 
00125     def test_closing_error(self):
00126         state = []
00127         class C:
00128             def close(self):
00129                 state.append(1)
00130         x = C()
00131         self.assertEqual(state, [])
00132         with self.assertRaises(ZeroDivisionError):
00133             with closing(x) as y:
00134                 self.assertEqual(x, y)
00135                 1 / 0
00136         self.assertEqual(state, [1])

Here is the call graph for this function:


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