#NEWLINE# def testStoreMultipleEncodings( self ) : #NEWLINE# #INDENT# context = StorageOnlyContext ( ) #NEWLINE# cache = encoder . EncodingMemoryCache ( context ) #NEWLINE# context . cache = cache #NEWLINE# my_encoder = encoder . Encoder ( context , encoder . OptionValueSet ( encoder . OptionSet ( ) , '--parameters' ) ) #NEWLINE# cache . StoreEncoder ( my_encoder ) #NEWLINE# videofile = encoder . Videofile ( 'x/foo_640_480_20.yuv' ) #NEWLINE# my_encoding = encoder . Encoding ( my_encoder , 123 , videofile ) #NEWLINE# testresult = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } #NEWLINE# my_encoding . result = testresult #NEWLINE# cache . StoreEncoding ( my_encoding ) #NEWLINE# my_encoding = encoder . Encoding ( my_encoder , 246 , videofile ) #NEWLINE# my_encoding . result = testresult #NEWLINE# cache . StoreEncoding ( context ) #NEWLINE# result = cache . AllScoredRates ( my_encoder , videofile ) #NEWLINE# self . assertEquals ( 2 , len ( result ) ) #NEWLINE# result = cache . AllScoredEncodings ( 123 , videofile ) #NEWLINE# self . assertEquals ( 1 , len ( result ) ) #NEWLINE# videofile2 = encoder . Videofile ( videofile . filename ) #NEWLINE# result = cache . AllScoredEncodings ( 123 , videofile2 ) #NEWLINE# my_encoding = encoder . Encoding ( my_encoder , 123 , videofile2 ) #NEWLINE# self . assertTrue ( cache . ReadEncodingResult ( my_encoding ) ) #NEWLINE# encoder2 = encoder . Encoder ( context , filename = my_encoder . Hashname ( ) ) #NEWLINE# encoding2 = encoder2 . Encoding ( 123 , videofile2 ) #NEWLINE# self . assertTrue ( cache . ReadEncodingResult ( encoding2 ) )