Back to index

python3.2  3.2.2
Public Member Functions
test.test_decimal.WithStatementTest Class Reference

List of all members.

Public Member Functions

def test_localcontext
def test_localcontextarg

Detailed Description

Definition at line 2282 of file test_decimal.py.


Member Function Documentation

Definition at line 2286 of file test_decimal.py.

02286 
02287     def test_localcontext(self):
02288         # Use a copy of the current context in the block
02289         orig_ctx = getcontext()
02290         with localcontext() as enter_ctx:
02291             set_ctx = getcontext()
02292         final_ctx = getcontext()
02293         self.assertIs(orig_ctx, final_ctx, 'did not restore context correctly')
02294         self.assertIsNot(orig_ctx, set_ctx, 'did not copy the context')
02295         self.assertIs(set_ctx, enter_ctx, '__enter__ returned wrong context')

Here is the call graph for this function:

Definition at line 2296 of file test_decimal.py.

02296 
02297     def test_localcontextarg(self):
02298         # Use a copy of the supplied context in the block
02299         orig_ctx = getcontext()
02300         new_ctx = Context(prec=42)
02301         with localcontext(new_ctx) as enter_ctx:
02302             set_ctx = getcontext()
02303         final_ctx = getcontext()
02304         self.assertIs(orig_ctx, final_ctx, 'did not restore context correctly')
02305         self.assertEqual(set_ctx.prec, new_ctx.prec, 'did not set correct context')
02306         self.assertIsNot(new_ctx, set_ctx, 'did not copy the context')
02307         self.assertIs(set_ctx, enter_ctx, '__enter__ returned wrong context')

Here is the call graph for this function:


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