#NEWLINE# @ mock . patch ( 'luigi.contrib.hive.run_hive_cmd' ) #NEWLINE# def test_table_exists( self , run_command ) : #NEWLINE# #INDENT# run_command . return_value = 'OK' #NEWLINE# returned = self . client . table_exists ( 'mytable' ) #NEWLINE# self . assertFalse ( returned ) #NEWLINE# run_command . return_value = 'OK\nmytable' #NEWLINE# returned = self . client . table_exists ( 'mytable' ) #NEWLINE# self . assertTrue ( returned ) #NEWLINE# returned = self . client . table_exists ( 'MyTable' ) #NEWLINE# self . assertTrue ( returned ) #NEWLINE# run_command . return_value = 'day=2013-06-28/hour=3\nday=2013-06-28/hour=4\nday=2013-07-07/hour=2\n' #NEWLINE# self . client . partition_spec = mock . Mock ( name = 'partition_spec' ) #NEWLINE# self . client . partition_spec . return_value = 'somepart' #NEWLINE# returned = self . client . table_exists ( 'mytable' , partition = { #NEWLINE# #INDENT# 'a' : 'b' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( returned ) #NEWLINE# run_command . return_value = '' #NEWLINE# returned = self . client . table_exists ( 'mytable' , partition = { #NEWLINE# #INDENT# 'a' : 'b' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertFalse ( returned )