<s> from __future__ import with_statement <EOL> import tempfile <EOL> from django . core . files import File <EOL> from django . utils . unittest import TestCase <EOL> class FileObjTests ( TestCase ) : <EOL> def test_context_manager ( self ) : <EOL> orig_file = tempfile . TemporaryFile ( ) <EOL> base_file = File ( orig_file ) <EOL> with base_file as f : <EOL> self . assertIs ( base_file , f ) <EOL> self . assertFalse ( f . closed ) <EOL> self . assertTrue ( f . closed ) <EOL> self . assertTrue ( orig_file . closed ) </s>
