Beispiel #1
0
 def test_regex_match(self):
     self.assertTrue(util.regex_match_func("/topic/create",
                                           "/topic/create"))
     self.assertTrue(
         util.regex_match_func("/topic/create/123", "/topic/create"))
     self.assertFalse(
         util.regex_match_func("/topic/delete", "/topic/create"))
     self.assertFalse(
         util.regex_match_func("/topic/edit", "/topic/edit/[0-9]+"))
     self.assertTrue(
         util.regex_match_func("/topic/edit/123", "/topic/edit/[0-9]+"))
     self.assertFalse(
         util.regex_match_func("/topic/edit/abc", "/topic/edit/[0-9]+"))
     self.assertFalse(
         util.regex_match_func("/foo/delete/123", "/topic/delete/[0-9]+"))
     self.assertTrue(
         util.regex_match_func("/topic/delete/0", "/topic/delete/[0-9]+"))
     self.assertFalse(
         util.regex_match_func("/topic/edit/123s", "/topic/delete/[0-9]+"))
Beispiel #2
0
 def matching_func(*args):
     time.sleep(0.01)
     return regex_match_func(*args)