gotta stop being so greedy. it's not fair for everyone else

This commit is contained in:
James Vega 2004-08-25 16:42:54 +00:00
parent a8b36c95f5
commit e0c5dbae43
2 changed files with 19 additions and 1 deletions

View File

@ -547,7 +547,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
irc.finished = True
def doFactoid(self, irc, msg, match):
r"^(.+)\s+(?<!\\)(was|is|am|were|are)\s+(also\s+)?(.+?)[?!. ]*$"
r"^(.+?)\s+(?<!\\)(was|is|am|were|are)\s+(also\s+)?(.+?)[?!. ]*$"
(key, isAre, also, value) = match.groups()
key = key.replace('\\', '')
if key.lower() in ('where', 'what', 'who', 'wtf'):

View File

@ -118,4 +118,22 @@ if sqlite is not None:
ibot.answerUnaddressedQuestions.setValue(answer)
ibot.snarfUnaddressedDefinitions.setValue(learn)
def testDoubleIsAre(self):
answer = ibot.answerUnaddressedQuestions()
learn = ibot.snarfUnaddressedDefinitions()
try:
ibot.answerUnaddressedQuestions.setValue(True)
ibot.snarfUnaddressedDefinitions.setValue(True)
self.assertSnarfNoResponse('foo is <reply> foo is bar')
self.assertSnarfRegexp('foo?', 'foo is bar')
self.assertSnarfNoResponse('bars are <reply> bars are good')
self.assertSnarfRegexp('bars?', 'bars are good')
self.assertSnarfNoResponse('bees are <reply> honey is good')
self.assertSnarfRegexp('bees?', 'honey is good')
self.assertSnarfNoResponse('food is <reply> tacos are good')
self.assertSnarfRegexp('food?', 'tacos are good')
finally:
ibot.answerUnaddressedQuestions.setValue(answer)
ibot.snarfUnaddressedDefinitions.setValue(learn)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: