@@ -609,23 +609,31 @@ def test_get_none(self):
609609 self .database ,
610610 server_id = 1024 ,
611611 resume_stream = False ,
612- only_events = [WriteRowsEvent ]
612+ only_events = [WriteRowsEvent ],
613613 )
614614 query = "CREATE TABLE null_operation_update_example (col1 INT, col2 INT);"
615615 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+ )
617619 self .execute (query )
618620 self .execute ("COMMIT" )
619621 write_rows_event = self .stream .fetchone ()
620622 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" )
622624
623625 def test_get_none_invalid (self ):
624626 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+ )
627633 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+ )
629637 self .execute ("COMMIT" )
630638
631639 self .assertIsInstance (self .stream .fetchone (), RotateEvent )
@@ -639,16 +647,20 @@ def test_get_none_invalid(self):
639647 else :
640648 self .assertEqual (event .event_type , UPDATE_ROWS_EVENT_V1 )
641649 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" )
652664
653665
654666class TestMultipleRowBinLogStreamReader (base .PyMySQLReplicationTestCase ):
0 commit comments