#NEWLINE# def test_matches( self ) : #NEWLINE# #INDENT# spl = SmartPlaylistPlugin ( ) #NEWLINE# a = MagicMock ( Album ) #NEWLINE# i = MagicMock ( Item ) #NEWLINE# self . assertFalse ( spl . matches ( i , None , None ) ) #NEWLINE# self . assertFalse ( spl . matches ( a , None , None ) ) #NEWLINE# query = Mock ( ) #NEWLINE# query . match . side_effect = { #NEWLINE# #INDENT# i : True , #NEWLINE# #UNINDENT# } . __getitem__ #NEWLINE# self . assertTrue ( spl . matches ( i , query , None ) ) #NEWLINE# self . assertFalse ( spl . matches ( a , query , None ) ) #NEWLINE# a_query = Mock ( ) #NEWLINE# a_query . match . side_effect = { #NEWLINE# #INDENT# i : True , #NEWLINE# #UNINDENT# } . __getitem__ #NEWLINE# self . assertFalse ( spl . matches ( i , None , a_query ) ) #NEWLINE# self . assertTrue ( spl . matches ( a , None , a_query ) ) #NEWLINE# self . assertTrue ( spl . matches ( i , query , a_query ) ) #NEWLINE# self . assertTrue ( spl . matches ( a , query , a_query ) )