Exemplo n.º 1
0
 def test_search_extract_from_pattern1(self) :
     """
         Basic search with text that will be found
     """
     search_details = SearchDetails(key_pattern = 'line 6 - (.*)$')
     self.assertEquals(search_pattern(search_details, self.file_array, 5),
                       'Company Name')
Exemplo n.º 2
0
 def test_search_simple_valid(self) :
     """
         Basic search with text that will be found
     """
     search_details = SearchDetails(key_pattern = 'Random Test')
     self.assertEquals(search_pattern(search_details, self.file_array, 0),
                       'Random Test')
Exemplo n.º 3
0
 def test_search_simple_search_not_found(self) :
     """
         Basic search with text that won't be found
     """
     search_details = SearchDetails(key_pattern = 'Wont Find This')
     self.assertEquals(search_pattern(search_details, self.file_array, 2),
                       None)
Exemplo n.º 4
0
 def test_search_simple_transform_pattern1(self) :
     """
         Basic search with text that will be found
     """
     search_details = SearchDetails(key_pattern = 'Random Test',
                                    value_pattern = '!!Target Name')
     self.assertEquals(search_pattern(search_details, self.file_array, 0),
                       'Target Name')
Exemplo n.º 5
0
 def test_search_bad_offset_positive(self) :
     """
         Extended search with text that will be found
     """
     search_details = SearchDetails(key_pattern = 'Random Test',
                                    value_pattern = 'Date Wibble',
                                    offset_line = 100)
     self.assertEquals(search_pattern(search_details, self.file_array, 0),
                       None)
Exemplo n.º 6
0
 def test_search_pattern1_offset(self) :
     """
         Extended search with text that will be found
     """
     search_details = SearchDetails(key_pattern = 'Random Test',
                                    value_pattern = 'Date (.*)$',
                                    offset_line = 1)
     self.assertEquals(search_pattern(search_details, self.file_array, 0),
                       '24 Jan 2010')