@@ -314,7 +314,7 @@ def test_diff_sorted_by_key(self):
314314 ]
315315 )
316316
317- differ = HashDiffer ()
317+ differ = HashDiffer (bisection_factor = 2 )
318318 diff = set (differ .diff_tables (self .table , self .table2 ))
319319 expected = {
320320 ("-" , ("2" , time2 + ".000000" )),
@@ -368,7 +368,7 @@ def test_diff_column_names(self):
368368 table1 = _table_segment (self .connection , self .table_src_path , "id" , "timestamp" , case_sensitive = False )
369369 table2 = _table_segment (self .connection , self .table_dst_path , "id2" , "timestamp2" , case_sensitive = False )
370370
371- differ = HashDiffer ()
371+ differ = HashDiffer (bisection_factor = 2 )
372372 diff = list (differ .diff_tables (table1 , table2 ))
373373 assert diff == []
374374
@@ -392,22 +392,22 @@ def setUp(self):
392392 ]
393393 )
394394
395- self .a = _table_segment (self .connection , self .table_src_path , "id" , "text_comment" , case_sensitive = False )
396- self .b = _table_segment (self .connection , self .table_dst_path , "id" , "text_comment" , case_sensitive = False )
395+ self .a = _table_segment (self .connection , self .table_src_path , "id" , extra_columns = ( "text_comment" ,), case_sensitive = False ). with_schema ( )
396+ self .b = _table_segment (self .connection , self .table_dst_path , "id" , extra_columns = ( "text_comment" ,), case_sensitive = False ). with_schema ( )
397397
398398 def test_string_keys (self ):
399- differ = HashDiffer ()
399+ differ = HashDiffer (bisection_factor = 2 )
400400 diff = list (differ .diff_tables (self .a , self .b ))
401401 self .assertEqual (diff , [("-" , (str (self .new_uuid ), "This one is different" ))])
402402
403+ # At this point the tables should already have a schema, to ensure the column is detected as UUID and not alpanum
403404 self .connection .query (self .src_table .insert_row ("unexpected" , "<-- this bad value should not break us" ))
404-
405405 self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
406406
407407 def test_where_sampling (self ):
408408 a = self .a .replace (where = "1=1" )
409409
410- differ = HashDiffer ()
410+ differ = HashDiffer (bisection_factor = 2 )
411411 diff = list (differ .diff_tables (a , self .b ))
412412 self .assertEqual (diff , [("-" , (str (self .new_uuid ), "This one is different" ))])
413413
@@ -501,7 +501,7 @@ def test_varying_alphanum_keys(self):
501501 for a in alphanums :
502502 assert a - a == 0
503503
504- differ = HashDiffer ()
504+ differ = HashDiffer (bisection_factor = 2 )
505505 diff = list (differ .diff_tables (self .a , self .b ))
506506 self .assertEqual (diff , [("-" , (str (self .new_alphanum ), "This one is different" ))])
507507
@@ -577,7 +577,7 @@ def setUp(self):
577577 self .b = _table_segment (self .connection , self .table_dst_path , "id" , "text_comment" , case_sensitive = False )
578578
579579 def test_uuid_column_with_nulls (self ):
580- differ = HashDiffer ()
580+ differ = HashDiffer (bisection_factor = 2 )
581581 diff = list (differ .diff_tables (self .a , self .b ))
582582 self .assertEqual (diff , [("-" , (str (self .null_uuid ), None ))])
583583
@@ -717,15 +717,15 @@ def test_right_table_empty(self):
717717 [self .src_table .create (), self .dst_table .create (), self .src_table .insert_rows (self .diffs ), commit ]
718718 )
719719
720- differ = HashDiffer ()
720+ differ = HashDiffer (bisection_factor = 2 )
721721 self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
722722
723723 def test_left_table_empty (self ):
724724 self .connection .query (
725725 [self .src_table .create (), self .dst_table .create (), self .dst_table .insert_rows (self .diffs ), commit ]
726726 )
727727
728- differ = HashDiffer ()
728+ differ = HashDiffer (bisection_factor = 2 )
729729 self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
730730
731731
0 commit comments