Example #1
0
 def test_parse_hook(self):
     x = replace.parse_hook("/foo/bar/voing")
     assert x == ("foo", "bar", "voing")
     x = replace.parse_hook("/foo/bar/vo/ing/")
     assert x == ("foo", "bar", "vo/ing/")
     x = replace.parse_hook("/bar/voing")
     assert x == (".*", "bar", "voing")
     tutils.raises("invalid replacement", replace.parse_hook, "/")
Example #2
0
 def test_parse_hook(self):
     x = replace.parse_hook("/foo/bar/voing")
     assert x == ("foo", "bar", "voing")
     x = replace.parse_hook("/foo/bar/vo/ing/")
     assert x == ("foo", "bar", "vo/ing/")
     x = replace.parse_hook("/bar/voing")
     assert x == (".*", "bar", "voing")
     with pytest.raises(Exception, match="Invalid replacement"):
         replace.parse_hook("/")
Example #3
0
 def test_parse_hook(self):
     x = replace.parse_hook("/foo/bar/voing")
     assert x == ("foo", "bar", "voing")
     x = replace.parse_hook("/foo/bar/vo/ing/")
     assert x == ("foo", "bar", "vo/ing/")
     x = replace.parse_hook("/bar/voing")
     assert x == (".*", "bar", "voing")
     with pytest.raises(Exception, match="Invalid replacement"):
         replace.parse_hook("/")
Example #4
0
 def replacepatterns(self):
     data = []
     for d in self.master.options.replacements:
         if isinstance(d, str):
             data.append(replace.parse_hook(d))
         else:
             data.append(d)
     self.master.view_grideditor(
         grideditor.ReplaceEditor(
             self.master, data, self.master.options.setter("replacements")))
Example #5
0
 def replacepatterns(self):
     data = []
     for d in self.master.options.replacements:
         if isinstance(d, str):
             data.append(replace.parse_hook(d))
         else:
             data.append(d)
     self.master.view_grideditor(
         grideditor.ReplaceEditor(
             self.master,
             data,
             self.master.options.setter("replacements")
         )
     )