@@ -225,7 +225,7 @@ class BasicTests(AbstractQTestCase):
225225 self .assertTrue (len (e ) == 1 )
226226
227227 s = sum (range (1 , 11 ))
228- self .assertTrue (o [0 ] == '%s %s' % (s , s / 10.0 ))
228+ self .assertTrue (o [0 ] == six . b ( '%s %s' % (s , s / 10.0 ) ))
229229 self .assertTrue (one_column_warning (e ))
230230
231231 self .cleanup (tmpfile )
@@ -241,7 +241,7 @@ class BasicTests(AbstractQTestCase):
241241 self .assertTrue (len (o ) == 0 )
242242 self .assertTrue (len (e ) == 1 )
243243
244- self .assertEquals (e [0 ],'Cannot decompress standard input. Pipe the input through zcat in order to decompress.' )
244+ self .assertEquals (e [0 ],six . b ( 'Cannot decompress standard input. Pipe the input through zcat in order to decompress.' ) )
245245
246246 self .cleanup (tmpfile )
247247
@@ -300,22 +300,22 @@ class BasicTests(AbstractQTestCase):
300300 self .assertEquals (len (o ), 3 )
301301 self .assertEquals (len (e ), 0 )
302302
303- self .assertEquals (" " .join (o ), 'a b c' )
303+ self .assertEquals (six . b ( " " ) .join (o ), six . b ( 'a b c' ) )
304304
305305 self .cleanup (tmpfile )
306306
307307 def test_tab_delimition_parameter (self ):
308308 tmpfile = self .create_file_with_data (
309- sample_data_no_header .replace ("," , "\t " ))
309+ sample_data_no_header .replace (six . b ( "," ), six . b ( "\t " ) ))
310310 cmd = '../bin/q -t "select c1,c2,c3 from %s"' % tmpfile .name
311311 retcode , o , e = run_command (cmd )
312312
313313 self .assertEquals (retcode , 0 )
314314 self .assertEquals (len (o ), 3 )
315315 self .assertEquals (len (e ), 0 )
316- self .assertEquals (o [0 ], sample_data_rows [0 ].replace ("," , "\t " ))
317- self .assertEquals (o [1 ], sample_data_rows [1 ].replace ("," , "\t " ))
318- self .assertEquals (o [2 ], sample_data_rows [2 ].replace ("," , "\t " ))
316+ self .assertEquals (o [0 ], sample_data_rows [0 ].replace (six . b ( "," ), six . b ( "\t " ) ))
317+ self .assertEquals (o [1 ], sample_data_rows [1 ].replace (six . b ( "," ), six . b ( "\t " ) ))
318+ self .assertEquals (o [2 ], sample_data_rows [2 ].replace (six . b ( "," ), six . b ( "\t " ) ))
319319
320320 self .cleanup (tmpfile )
321321
@@ -358,9 +358,9 @@ class BasicTests(AbstractQTestCase):
358358 self .assertEquals (len (o ), 3 )
359359 self .assertEquals (len (e ), 0 )
360360
361- self .assertEquals (o [0 ], sample_data_rows [0 ].replace ("," , "\t " ))
362- self .assertEquals (o [1 ], sample_data_rows [1 ].replace ("," , "\t " ))
363- self .assertEquals (o [2 ], sample_data_rows [2 ].replace ("," , "\t " ))
361+ self .assertEquals (o [0 ], sample_data_rows [0 ].replace (six . b ( "," ), six . b ( "\t " ) ))
362+ self .assertEquals (o [1 ], sample_data_rows [1 ].replace (six . b ( "," ), six . b ( "\t " ) ))
363+ self .assertEquals (o [2 ], sample_data_rows [2 ].replace (six . b ( "," ), six . b ( "\t " ) ))
364364
365365 self .cleanup (tmpfile )
366366
@@ -572,7 +572,7 @@ class BasicTests(AbstractQTestCase):
572572 self .assertEquals (len (o ), 0 )
573573 self .assertEquals (len (e ), 1 )
574574
575- self .assertTrue ('Warning - data is empty' in e [0 ])
575+ self .assertTrue (six . b ( 'Warning - data is empty' ) in e [0 ])
576576
577577 self .cleanup (tmpfile )
578578
@@ -624,17 +624,17 @@ class BasicTests(AbstractQTestCase):
624624
625625 def test_spaces_in_header_row (self ):
626626 tmpfile = self .create_file_with_data (
627- header_row_with_spaces + "\n " + sample_data_no_header )
627+ header_row_with_spaces + six . b ( "\n " ) + sample_data_no_header )
628628 cmd = '../bin/q -d , "select name,\`value 1\` from %s" -H' % tmpfile .name
629629 retcode , o , e = run_command (cmd )
630630
631631 self .assertEquals (retcode , 0 )
632632 self .assertEquals (len (e ), 0 )
633633 self .assertEquals (len (o ), 3 )
634634
635- self .assertEquals (o [0 ], 'a,1' )
636- self .assertEquals (o [1 ], 'b,2' )
637- self .assertEquals (o [2 ], 'c,' )
635+ self .assertEquals (o [0 ], six . b ( 'a,1' ) )
636+ self .assertEquals (o [1 ], six . b ( 'b,2' ) )
637+ self .assertEquals (o [2 ], six . b ( 'c,' ) )
638638
639639 self .cleanup (tmpfile )
640640
@@ -720,7 +720,7 @@ class BasicTests(AbstractQTestCase):
720720
721721 def test_use_query_file (self ):
722722 tmp_data_file = self .create_file_with_data (sample_data_with_header )
723- tmp_query_file = self .create_file_with_data ("select name from %s" % tmp_data_file .name )
723+ tmp_query_file = self .create_file_with_data (six . b ( "select name from %s" % tmp_data_file .name ) )
724724
725725 cmd = '../bin/q -d , -q %s -H' % tmp_query_file .name
726726 retcode , o , e = run_command (cmd )
@@ -959,7 +959,7 @@ class BasicTests(AbstractQTestCase):
959959 self .assertEquals (len (e ),1 )
960960 self .assertEquals (len (o ),0 )
961961
962- self .assertTrue (e [0 ].startswith ('Strict mode. Column Count is expected to identical' ))
962+ self .assertTrue (e [0 ].startswith (six . b ( 'Strict mode. Column Count is expected to identical' ) ))
963963
964964 self .cleanup (tmp_data_file )
965965
@@ -1343,9 +1343,9 @@ class BasicTests(AbstractQTestCase):
13431343 self .cleanup (tmpfile )
13441344
13451345 def test_default_column_max_length_parameter__too_long (self ):
1346- huge_text = "x" * 132000
1346+ huge_text = six . b ( "x" ) * 132000
13471347
1348- file_data = "a,b,c\n 1,%s ,3\n " % huge_text
1348+ file_data = six . b ( "a,b,c\n 1,{} ,3\n " . format ( huge_text ))
13491349
13501350 tmpfile = self .create_file_with_data (file_data )
13511351
@@ -1356,9 +1356,9 @@ class BasicTests(AbstractQTestCase):
13561356 self .assertEquals (len (o ), 0 )
13571357 self .assertEquals (len (e ), 1 )
13581358
1359- self .assertTrue (e [0 ].startswith ("Column length is larger than the maximum" ))
1360- self .assertTrue (("Offending file is '%s'" % tmpfile .name ) in e [0 ])
1361- self .assertTrue ('Line is 2' in e [0 ])
1359+ self .assertTrue (e [0 ].startswith (six . b ( "Column length is larger than the maximum" ) ))
1360+ self .assertTrue (six . b ("Offending file is '{}'" . format ( tmpfile .name ) ) in e [0 ])
1361+ self .assertTrue (six . b ( 'Line is 2' ) in e [0 ])
13621362
13631363 self .cleanup (tmpfile )
13641364
0 commit comments