#NEWLINE# def test_TSO_filters( self ) : #NEWLINE# #INDENT# ' Tests TwitterSearchOrder advanced filtering methods ' #NEWLINE# tso = self . getCopy ( ) #NEWLINE# source = 'nyancat' #NEWLINE# self . assertTrue ( ( tso . source_filter is None ) ) #NEWLINE# tso . set_source_filter ( source ) #NEWLINE# self . assertEqual ( tso . source_filter , source ) #NEWLINE# self . assertTrue ( ( ( 'source%3a' + source ) in tso . create_search_url ( ) . lower ( ) ) ) #NEWLINE# tso . remove_source_filter ( ) #NEWLINE# self . assertTrue ( ( tso . source_filter is None ) ) #NEWLINE# for obj in ( [ ] , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , None , 2 , 37.1 , '' ) : #NEWLINE# #INDENT# with self . assertRaises ( TwitterSearchException ) : #NEWLINE# #INDENT# tso . set_source_filter ( obj ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertFalse ( tso . link_filter ) #NEWLINE# tso . set_link_filter ( ) #NEWLINE# self . assertTrue ( tso . link_filter ) #NEWLINE# self . assertTrue ( ( 'filter%3alinks' in tso . create_search_url ( ) . lower ( ) ) ) #NEWLINE# tso . remove_link_filter ( ) #NEWLINE# self . assertFalse ( tso . link_filter ) #NEWLINE# self . assertFalse ( tso . question_filter ) #NEWLINE# tso . set_question_filter ( ) #NEWLINE# self . assertTrue ( tso . question_filter ) #NEWLINE# self . assertTrue ( ( '%3f' in tso . create_search_url ( ) . lower ( ) ) ) #NEWLINE# tso . remove_question_filter ( ) #NEWLINE# self . assertFalse ( tso . question_filter ) #NEWLINE# self . assertTrue ( ( self . attitude_filter is None ) ) #NEWLINE# tso . set_negative_attitude_filter ( ) #NEWLINE# self . assertFalse ( tso . attitude_filter ) #NEWLINE# self . assertTrue ( ( '%3a%28' in tso . create_search_url ( ) . lower ( ) ) ) #NEWLINE# tso . remove_attitude_filter ( ) #NEWLINE# self . assertTrue ( ( tso . attitude_filter is None ) ) #NEWLINE# tso . set_positive_attitude_filter ( ) #NEWLINE# self . assertTrue ( tso . attitude_filter ) #NEWLINE# self . assertTrue ( ( '%3a%29' in tso . create_search_url ( ) . lower ( ) ) ) #NEWLINE# tso . remove_attitude_filter ( ) #NEWLINE# self . assertTrue ( ( tso . attitude_filter is None ) )