#NEWLINE# def testExecuteAndUnpackWhenError( self ) : #NEWLINE# #INDENT# 'Test ExecuteAndUnpack().' #NEWLINE# self . mox . StubOutWithMock ( self . asr , 'Execute' ) #NEWLINE# mock_ret = self . mox . CreateMockAnything ( ) #NEWLINE# mock_item = self . mox . CreateMockAnything ( ) #NEWLINE# mock_ret = self . mox . CreateMockAnything ( ) #NEWLINE# unpack_fmt = 'sbi' #NEWLINE# args = [ 'some value' ] #NEWLINE# osa_script = 'some script %s' #NEWLINE# self . asr . Execute ( osa_script , args ) . AndReturn ( mock_ret ) #NEWLINE# mock_ret . numberOfItems ( ) . AndReturn ( ( len ( unpack_fmt ) + 1 ) ) #NEWLINE# self . asr . Execute ( osa_script , args ) . AndReturn ( mock_ret ) #NEWLINE# mock_ret . numberOfItems ( ) . AndReturn ( ( len ( mock_item ) + 1 ) ) #NEWLINE# mock_ret . descriptorAtIndex_ ( 1 ) . AndReturn ( mock_item ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# self . assertRaises ( applescript . Error , self . asr . ExecuteAndUnpack , osa_script , unpack_fmt , args ) #NEWLINE# unpack_fmt = 'xsbi' #NEWLINE# self . assertRaises ( applescript . Error , self . asr . ExecuteAndUnpack , osa_script , unpack_fmt , args ) #NEWLINE# self . mox . VerifyAll ( )