mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fixed a couple bugs and added tests for said bugs.
This commit is contained in:
parent
45b534fa03
commit
2657257535
@ -162,7 +162,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
LIMIT 20""", key)
|
LIMIT 20""", key)
|
||||||
return [t[0] for t in cursor.fetchall()]
|
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 factoids:
|
||||||
if number:
|
if number:
|
||||||
try:
|
try:
|
||||||
@ -431,7 +431,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
formats.append(glob.translate(self._sqlTrans))
|
formats.append(glob.translate(self._sqlTrans))
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
sql = """SELECT keys.key FROM %s WHERE %s""" % \
|
sql = """SELECT keys.key FROM %s WHERE %s""" % \
|
||||||
(tables, ' AND '.join(criteria))
|
(', '.join(tables), ' AND '.join(criteria))
|
||||||
sql = sql.replace('TARGET', target)
|
sql = sql.replace('TARGET', target)
|
||||||
cursor.execute(sql, formats)
|
cursor.execute(sql, formats)
|
||||||
if cursor.rowcount == 0:
|
if cursor.rowcount == 0:
|
||||||
@ -447,7 +447,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
s = utils.commaAndify(keys)
|
s = utils.commaAndify(keys)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
|
|
||||||
|
|
||||||
Class = Factoids
|
Class = Factoids
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,6 +106,8 @@ if sqlite is not None:
|
|||||||
'inkedmn.*strike|strike.*inkedmn')
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
self.assertRegexp('factoids search jemfinch',
|
self.assertRegexp('factoids search jemfinch',
|
||||||
'my primary author')
|
'my primary author')
|
||||||
|
self.assertRegexp('factoids search --values primary author',
|
||||||
|
'my primary author')
|
||||||
|
|
||||||
def testWhatisOnNumbers(self):
|
def testWhatisOnNumbers(self):
|
||||||
self.assertNotError('learn 911 as emergency number')
|
self.assertNotError('learn 911 as emergency number')
|
||||||
|
Loading…
Reference in New Issue
Block a user