15
15
from .common import str_to_checksum , test_each_database_in_list , TestPerDatabase
16
16
17
17
18
- TEST_DATABASES = {db .MySQL , db .PostgreSQL , db .Oracle , db .Redshift , db .Snowflake , db .BigQuery }
18
+ TEST_DATABASES = {
19
+ db .MySQL ,
20
+ db .PostgreSQL ,
21
+ db .Oracle ,
22
+ db .Redshift ,
23
+ db .Snowflake ,
24
+ db .BigQuery ,
25
+ db .Presto ,
26
+ db .Trino ,
27
+ db .Vertica ,
28
+ }
19
29
20
30
test_each_database : Callable = test_each_database_in_list (TEST_DATABASES )
21
31
@@ -383,9 +393,7 @@ def test_string_keys(self):
383
393
diff = list (differ .diff_tables (self .a , self .b ))
384
394
self .assertEqual (diff , [("-" , (str (self .new_uuid ), "This one is different" ))])
385
395
386
- self .connection .query (
387
- self .src_table .insert_row ('unexpected' , '<-- this bad value should not break us' )
388
- )
396
+ self .connection .query (self .src_table .insert_row ("unexpected" , "<-- this bad value should not break us" ))
389
397
390
398
self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
391
399
@@ -421,7 +429,7 @@ def setUp(self):
421
429
src_table .create (),
422
430
src_table .insert_rows (values ),
423
431
table (self .table_dst_path ).create (src_table ),
424
- src_table .insert_row (self .new_alphanum , ' This one is different' ),
432
+ src_table .insert_row (self .new_alphanum , " This one is different" ),
425
433
commit ,
426
434
]
427
435
@@ -491,7 +499,7 @@ def test_varying_alphanum_keys(self):
491
499
self .assertEqual (diff , [("-" , (str (self .new_alphanum ), "This one is different" ))])
492
500
493
501
self .connection .query (
494
- self .src_table .insert_row (' @@@' , ' <-- this bad value should not break us' ),
502
+ self .src_table .insert_row (" @@@" , " <-- this bad value should not break us" ),
495
503
commit ,
496
504
)
497
505
@@ -548,13 +556,15 @@ def setUp(self):
548
556
549
557
self .null_uuid = uuid .uuid1 (32132131 )
550
558
551
- self .connection .query ([
552
- src_table .create (),
553
- src_table .insert_rows (values ),
554
- table (self .table_dst_path ).create (src_table ),
555
- src_table .insert_row (self .null_uuid , None ),
556
- commit ,
557
- ])
559
+ self .connection .query (
560
+ [
561
+ src_table .create (),
562
+ src_table .insert_rows (values ),
563
+ table (self .table_dst_path ).create (src_table ),
564
+ src_table .insert_row (self .null_uuid , None ),
565
+ commit ,
566
+ ]
567
+ )
558
568
559
569
self .a = _table_segment (self .connection , self .table_src_path , "id" , "text_comment" , case_sensitive = False )
560
570
self .b = _table_segment (self .connection , self .table_dst_path , "id" , "text_comment" , case_sensitive = False )
@@ -576,9 +586,9 @@ def setUp(self):
576
586
self .connection .query (
577
587
[
578
588
src_table .create (),
579
- src_table .insert_row (uuid .uuid1 (1 ), '1' ),
589
+ src_table .insert_row (uuid .uuid1 (1 ), "1" ),
580
590
table (self .table_dst_path ).create (src_table ),
581
- src_table .insert_row (self .null_uuid , None ), # Add a row where a column has NULL value
591
+ src_table .insert_row (self .null_uuid , None ), # Add a row where a column has NULL value
582
592
commit ,
583
593
]
584
594
)
@@ -685,24 +695,28 @@ class TestTableTableEmpty(TestPerDatabase):
685
695
def setUp (self ):
686
696
super ().setUp ()
687
697
688
- self .src_table = src_table = table (self .table_src_path , schema = {"id" : str , "text_comment" : str })
689
- self .dst_table = dst_table = table (self .table_dst_path , schema = {"id" : str , "text_comment" : str })
698
+ self .src_table = table (self .table_src_path , schema = {"id" : str , "text_comment" : str })
699
+ self .dst_table = table (self .table_dst_path , schema = {"id" : str , "text_comment" : str })
690
700
691
701
self .null_uuid = uuid .uuid1 (1 )
692
702
693
703
self .diffs = [(uuid .uuid1 (i ), str (i )) for i in range (100 )]
694
704
695
- self .connection .query ([src_table .create (), dst_table .create (), src_table .insert_rows (self .diffs ), commit ])
696
-
697
705
self .a = _table_segment (self .connection , self .table_src_path , "id" , "text_comment" , case_sensitive = False )
698
706
self .b = _table_segment (self .connection , self .table_dst_path , "id" , "text_comment" , case_sensitive = False )
699
707
700
708
def test_right_table_empty (self ):
709
+ self .connection .query (
710
+ [self .src_table .create (), self .dst_table .create (), self .src_table .insert_rows (self .diffs ), commit ]
711
+ )
712
+
701
713
differ = HashDiffer ()
702
714
self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
703
715
704
716
def test_left_table_empty (self ):
705
- self .connection .query ([self .dst_table .insert_expr (self .src_table ), self .src_table .truncate (), commit ])
717
+ self .connection .query (
718
+ [self .src_table .create (), self .dst_table .create (), self .dst_table .insert_rows (self .diffs ), commit ]
719
+ )
706
720
707
721
differ = HashDiffer ()
708
722
self .assertRaises (ValueError , list , differ .diff_tables (self .a , self .b ))
0 commit comments