Beispiel #1
0
 def test_check_line(self):
     self.assertTrue(
         regex_utils.check_line('.*(\d+.\d+.\d+.\d+)',
                                'MyIP is 192.168.199.4'))
     self.assertTrue(
         regex_utils.check_line('Test (Data|Case) For (py-text|py-task)',
                                'Test Data For py-text'))
     self.assertFalse(
         regex_utils.check_line('.*(\d+.\d+.\d+.{100,255})',
                                'MyIP is 192.168.199.4'))
     self.assertFalse(regex_utils.check_line(None, 'Test Word'))
     self.assertFalse(regex_utils.check_line('.*', None))
Beispiel #2
0
 def filter(self, filename):
     if string_utils.is_empty(filename):
         return False
     
     if hasattr(self, "file_filter"):
         flag = False
         for filter_item in self.file_filter:
             if regex_utils.check_line(str(filter_item), filename):
                 flag = True
                 break
         return flag
     else:
         return True
Beispiel #3
0
    def filter(self, filename):
        if string_utils.is_empty(filename):
            return False

        if hasattr(self, "file_filter"):
            flag = False
            for filter_item in self.file_filter:
                if regex_utils.check_line(str(filter_item), filename):
                    flag = True
                    break
            return flag
        else:
            return True
Beispiel #4
0
 def test_check_line(self):
     self.assertTrue(regex_utils.check_line('.*(\d+.\d+.\d+.\d+)', 'MyIP is 192.168.199.4'))
     self.assertTrue(regex_utils.check_line('Test (Data|Case) For (py-text|py-task)', 'Test Data For py-text'))
     self.assertFalse(regex_utils.check_line('.*(\d+.\d+.\d+.{100,255})', 'MyIP is 192.168.199.4'))
     self.assertFalse(regex_utils.check_line(None, 'Test Word'))
     self.assertFalse(regex_utils.check_line('.*', None))