<s> import unittest <EOL> from robotide . robotapi import TestCase <EOL> from robotide . controller . macrocontrollers import TestCaseController <EOL> from robotide . searchtests . searchtests import TestSearchMatcher <EOL> class _TestSearchTest ( object ) : <EOL> def _test ( self , name = '<STR_LIT:name>' , tags = None , doc = '<STR_LIT>' ) : <EOL> parent = lambda : <NUM_LIT:0> <EOL> parent . datafile_controller = parent <EOL> parent . register_for_namespace_updates = lambda * _ : <NUM_LIT:0> <EOL> parent . force_tags = [ ] <EOL> parent . default_tags = [ ] <EOL> robot_test = TestCase ( parent = parent , name = name ) <EOL> robot_test . get_setter ( '<STR_LIT>' ) ( doc ) <EOL> robot_test . get_setter ( '<STR_LIT>' ) ( tags or [ ] ) <EOL> test = TestCaseController ( parent , robot_test ) <EOL> return test <EOL> def _match ( self , text , name = '<STR_LIT:name>' , tags = None , doc = '<STR_LIT>' ) : <EOL> return TestSearchMatcher ( text ) . matches ( self . _test ( name , tags , doc ) ) <EOL> class TestTestSearchMatcher ( _TestSearchTest , unittest . TestCase ) : <EOL> def test_matching_name ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT:name>' , name = '<STR_LIT:name>' ) ) <EOL> def test_not_matching ( self ) : <EOL> self . assertFalse ( self . _match ( '<STR_LIT>' , name = '<STR_LIT>' , <EOL> tags = [ '<STR_LIT>' ] , doc = '<STR_LIT>' ) ) <EOL> def test_matching_name_partially ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , doc = '<STR_LIT>' ) ) <EOL> def test_matching_name_is_case_insensitive_in_tags ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , tags = [ '<STR_LIT>' ] ) ) <EOL> def test_matching_name_is_case_insensitive_in_name ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , name = '<STR_LIT>' ) ) <EOL> def test_matching_name_is_case_insensitive_in_doc ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , doc = '<STR_LIT>' ) ) <EOL> def test_matching_to_documentation ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , doc = '<STR_LIT>' ) ) <EOL> def test_matching_to_tag ( self ) : <EOL> self . assertTrue ( self . _match ( '<STR_LIT>' , tags = [ '<STR_LIT>' ] ) ) <EOL> def test_multiple_match_terms ( self ) : <EOL> self . assertTrue ( self . _match ( <EOL> '<STR_LIT>' , name = '<STR_LIT>' , <EOL> tags = [ '<STR_LIT:foo>' , '<STR_LIT>' , '<STR_LIT:bar>' ] , doc = '<STR_LIT>' ) ) </s>
