Fixed the bug in acronym for the change in format and tightened the test to catch such changes.

This commit is contained in:
Jeremy Fincher 2003-11-22 01:13:33 +00:00
parent 4ed97b0ba5
commit 7784d21cde
2 changed files with 3 additions and 2 deletions

View File

@ -264,7 +264,7 @@ class Http(callbacks.Privmsg):
quote = ' // '.join(quote.splitlines())
irc.reply(msg, quote)
_acronymre = re.compile(r'<td[^w]+width="70[^>]+>(?:<b>)?([^<]+)(?:</b>)?')
_acronymre = re.compile(r'width="71%" bgcolor="[^"]+">(?:<b>)?([^<]+)')
def acronym(self, irc, msg, args):
"""<acronym>
@ -284,7 +284,7 @@ class Http(callbacks.Privmsg):
defs[i] = s.split('is ', 1)[1]
#debug.printf(defs)
if len(defs) == 0:
irc.reply(msg, 'No definitions found.')
irc.reply(msg,'No definitions found. (%s)'%conf.replyPossibleBug)
else:
s = ', or '.join(defs)
irc.reply(msg, '%s could be %s' % (acronym, s))

View File

@ -66,6 +66,7 @@ class HttpTest(PluginTestCase, PluginDocumentation):
self.assertError('geekquote --id=48a')
def testAcronym(self):
self.assertRegexp('acronym ASAP', 'as soon as possible')
self.assertNotError('acronym PERL')
self.assertNotRegexp('acronym UNIX', 'not an acronym')