<s> """<STR_LIT>""" <EOL> import os <EOL> import shutil <EOL> from django . core . files . uploadedfile import SimpleUploadedFile <EOL> from django . utils import unittest <EOL> from regressiontests . bug639 . models import Photo , PhotoForm , temp_storage_dir <EOL> class Bug639Test ( unittest . TestCase ) : <EOL> def testBug639 ( self ) : <EOL> """<STR_LIT>""" <EOL> filename = os . path . join ( os . path . dirname ( __file__ ) , "<STR_LIT>" ) <EOL> img = open ( filename , "<STR_LIT:rb>" ) . read ( ) <EOL> data = { '<STR_LIT:title>' : '<STR_LIT>' } <EOL> files = { "<STR_LIT:image>" : SimpleUploadedFile ( '<STR_LIT>' , img , '<STR_LIT>' ) } <EOL> form = PhotoForm ( data = data , files = files ) <EOL> p = form . save ( ) <EOL> self . assertEqual ( p . _savecount , <NUM_LIT:1> ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> p = Photo . objects . get ( ) <EOL> p . image . delete ( save = False ) <EOL> shutil . rmtree ( temp_storage_dir ) </s>
