Fixed a couple bugs and added tests for said bugs.

This commit is contained in:
James Vega 2004-06-19 00:10:04 +00:00
parent 45b534fa03
commit 2657257535
2 changed files with 5 additions and 3 deletions

View File

@ -162,7 +162,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
LIMIT 20""", key)
return [t[0] for t in cursor.fetchall()]
def _replyFactoids(self, irc, key, factoids, number=0, error=False):
def _replyFactoids(self, irc, key, factoids, number=0, error=True):
if factoids:
if number:
try:
@ -431,7 +431,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
formats.append(glob.translate(self._sqlTrans))
cursor = db.cursor()
sql = """SELECT keys.key FROM %s WHERE %s""" % \
(tables, ' AND '.join(criteria))
(', '.join(tables), ' AND '.join(criteria))
sql = sql.replace('TARGET', target)
cursor.execute(sql, formats)
if cursor.rowcount == 0:
@ -447,7 +447,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
s = utils.commaAndify(keys)
irc.reply(s)
Class = Factoids

View File

@ -106,6 +106,8 @@ if sqlite is not None:
'inkedmn.*strike|strike.*inkedmn')
self.assertRegexp('factoids search jemfinch',
'my primary author')
self.assertRegexp('factoids search --values primary author',
'my primary author')
def testWhatisOnNumbers(self):
self.assertNotError('learn 911 as emergency number')