@@ -609,23 +609,31 @@ def test_get_none(self):
609
609
self .database ,
610
610
server_id = 1024 ,
611
611
resume_stream = False ,
612
- only_events = [WriteRowsEvent ]
612
+ only_events = [WriteRowsEvent ],
613
613
)
614
614
query = "CREATE TABLE null_operation_update_example (col1 INT, col2 INT);"
615
615
self .execute (query )
616
- query = "INSERT INTO null_operation_update_example (col1, col2) VALUES (NULL, 1);"
616
+ query = (
617
+ "INSERT INTO null_operation_update_example (col1, col2) VALUES (NULL, 1);"
618
+ )
617
619
self .execute (query )
618
620
self .execute ("COMMIT" )
619
621
write_rows_event = self .stream .fetchone ()
620
622
self .assertIsInstance (write_rows_event , WriteRowsEvent )
621
- self .assertEqual (write_rows_event .rows [0 ][' none_sources' ][ ' col1' ], ' null' )
623
+ self .assertEqual (write_rows_event .rows [0 ][" none_sources" ][ " col1" ], " null" )
622
624
623
625
def test_get_none_invalid (self ):
624
626
self .execute ("SET SESSION SQL_MODE='ALLOW_INVALID_DATES'" )
625
- self .execute ("CREATE TABLE test_table (col0 INT, col1 VARCHAR(10), col2 DATETIME, col3 DATE, col4 SET('a', 'b', 'c'))" )
626
- self .execute ("INSERT INTO test_table VALUES (NULL, NULL, '0000-00-00 00:00:00', NULL, NULL)" )
627
+ self .execute (
628
+ "CREATE TABLE test_table (col0 INT, col1 VARCHAR(10), col2 DATETIME, col3 DATE, col4 SET('a', 'b', 'c'))"
629
+ )
630
+ self .execute (
631
+ "INSERT INTO test_table VALUES (NULL, NULL, '0000-00-00 00:00:00', NULL, NULL)"
632
+ )
627
633
self .resetBinLog ()
628
- self .execute ("UPDATE test_table SET col1 = NULL, col2 = NULL, col3='0000-00-00',col4 = 'd' WHERE col0 IS NULL" )
634
+ self .execute (
635
+ "UPDATE test_table SET col1 = NULL, col2 = NULL, col3='0000-00-00',col4 = 'd' WHERE col0 IS NULL"
636
+ )
629
637
self .execute ("COMMIT" )
630
638
631
639
self .assertIsInstance (self .stream .fetchone (), RotateEvent )
@@ -639,16 +647,20 @@ def test_get_none_invalid(self):
639
647
else :
640
648
self .assertEqual (event .event_type , UPDATE_ROWS_EVENT_V1 )
641
649
self .assertIsInstance (event , UpdateRowsEvent )
642
- self .assertEqual (event .rows [0 ]["before_none_source" ]["col0" ], 'null' )
643
- self .assertEqual (event .rows [0 ]["before_none_source" ]["col1" ], 'null' )
644
- self .assertEqual (event .rows [0 ]["before_none_source" ]["col2" ], 'out of datetime2 range' )
645
- self .assertEqual (event .rows [0 ]["before_none_source" ]["col3" ], 'null' )
646
- self .assertEqual (event .rows [0 ]["before_none_source" ]["col4" ], 'null' )
647
- self .assertEqual (event .rows [0 ]["after_none_source" ]["col0" ], 'null' )
648
- self .assertEqual (event .rows [0 ]["after_none_source" ]["col1" ], 'null' )
649
- self .assertEqual (event .rows [0 ]["after_none_source" ]["col2" ], 'null' )
650
- self .assertEqual (event .rows [0 ]["after_none_source" ]["col3" ], 'out of date range' )
651
- self .assertEqual (event .rows [0 ]["after_none_source" ]["col4" ], 'empty set' )
650
+ self .assertEqual (event .rows [0 ]["before_none_source" ]["col0" ], "null" )
651
+ self .assertEqual (event .rows [0 ]["before_none_source" ]["col1" ], "null" )
652
+ self .assertEqual (
653
+ event .rows [0 ]["before_none_source" ]["col2" ], "out of datetime2 range"
654
+ )
655
+ self .assertEqual (event .rows [0 ]["before_none_source" ]["col3" ], "null" )
656
+ self .assertEqual (event .rows [0 ]["before_none_source" ]["col4" ], "null" )
657
+ self .assertEqual (event .rows [0 ]["after_none_source" ]["col0" ], "null" )
658
+ self .assertEqual (event .rows [0 ]["after_none_source" ]["col1" ], "null" )
659
+ self .assertEqual (event .rows [0 ]["after_none_source" ]["col2" ], "null" )
660
+ self .assertEqual (
661
+ event .rows [0 ]["after_none_source" ]["col3" ], "out of date range"
662
+ )
663
+ self .assertEqual (event .rows [0 ]["after_none_source" ]["col4" ], "empty set" )
652
664
653
665
654
666
class TestMultipleRowBinLogStreamReader (base .PyMySQLReplicationTestCase ):
0 commit comments