Format.replace: replacement text is now allowed to be the empty string.

This commit is contained in:
Daniel Folkinshteyn 2010-08-05 01:27:38 -04:00
parent 9398025088
commit 1b84e208ca
2 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,7 @@ class Format(callbacks.Plugin):
with <substring to replace it with> in <text>. with <substring to replace it with> in <text>.
""" """
irc.reply(text.replace(bad, good)) irc.reply(text.replace(bad, good))
replace = wrap(replace, ['something', 'something', 'text']) replace = wrap(replace, ['something', 'anything', 'text'])
def upper(self, irc, msg, args, text): def upper(self, irc, msg, args, text):
"""<text> """<text>

View File

@ -58,6 +58,7 @@ class FormatTestCase(PluginTestCase):
def testReplace(self): def testReplace(self):
self.assertResponse('replace # %23 bla#foo', 'bla%23foo') self.assertResponse('replace # %23 bla#foo', 'bla%23foo')
self.assertResponse('replace foo "" blafoobar', 'blabar')
def testUpper(self): def testUpper(self):
self.assertResponse('upper foo', 'FOO') self.assertResponse('upper foo', 'FOO')