#NEWLINE# def test_db_changes( self ) : #NEWLINE# #INDENT# spl = SmartPlaylistPlugin ( ) #NEWLINE# nones = ( None , None ) #NEWLINE# pl1 = ( '1' , ( 'q1' , None ) , nones ) #NEWLINE# pl2 = ( '2' , ( 'q2' , None ) , nones ) #NEWLINE# pl3 = ( '3' , ( 'q3' , None ) , nones ) #NEWLINE# spl . _unmatched_playlists = set ( [ pl1 , pl2 , pl3 ] ) #NEWLINE# spl . _matched_playlists = set ( ) #NEWLINE# spl . matches = Mock ( return_value = False ) #NEWLINE# spl . db_change ( None , 'nothing' ) #NEWLINE# self . assertEqual ( spl . _unmatched_playlists , set ( [ pl1 , pl2 , pl3 ] ) ) #NEWLINE# self . assertEqual ( spl . _matched_playlists , set ( ) ) #NEWLINE# spl . matches . side_effect = ( lambda _ , q , __ : ( q == 'q3' ) ) #NEWLINE# spl . db_change ( None , 'matches 3' ) #NEWLINE# self . assertEqual ( spl . _unmatched_playlists , set ( [ pl1 , pl2 ] ) ) #NEWLINE# self . assertEqual ( spl . _matched_playlists , set ( [ pl3 ] ) ) #NEWLINE# spl . matches . side_effect = ( lambda _ , q , __ : ( q == 'q1' ) ) #NEWLINE# spl . db_change ( None , 'matches 3' ) #NEWLINE# self . assertEqual ( spl . _matched_playlists , set ( [ pl1 , pl3 ] ) ) #NEWLINE# self . assertEqual ( spl . _unmatched_playlists , set ( [ pl2 ] ) )