#NEWLINE# @ mock . patch ( 'luigi.contrib.hive.run_hive_cmd' ) #NEWLINE# def test_table_schema( self , run_command ) : #NEWLINE# #INDENT# run_command . return_value = 'FAILED: SemanticException [Error 10001]: blah does not exist\nSome other stuff' #NEWLINE# returned = self . client . table_schema ( 'mytable' ) #NEWLINE# self . assertFalse ( returned ) #NEWLINE# run_command . return_value = 'OK\ncol1       \tstring              \tNone                \ncol2            \tstring              \tNone                \ncol3         \tstring              \tNone                \nday                 \tstring              \tNone                \nhour                \tsmallint            \tNone                \n\n# Partition Information\t \t \n# col_name            \tdata_type           \tcomment             \n\nday                 \tstring              \tNone                \nhour                \tsmallint            \tNone                \nTime taken: 2.08 seconds, Fetched: 34 row(s)\n' #NEWLINE# expected = [ ( 'OK' , ) , ( 'col1' , 'string' , 'None' ) , ( 'col2' , 'string' , 'None' ) , ( 'col3' , 'string' , 'None' ) , ( 'day' , 'string' , 'None' ) , ( 'hour' , 'smallint' , 'None' ) , ( '' , ) , ( '# Partition Information' , ) , ( '# col_name' , 'data_type' , 'comment' ) , ( '' , ) , ( 'day' , 'string' , 'None' ) , ( 'hour' , 'smallint' , 'None' ) , ( 'Time taken: 2.08 seconds, Fetched: 34 row(s)' , ) ] #NEWLINE# returned = self . client . table_schema ( 'mytable' ) #NEWLINE# self . assertEqual ( returned , returned )