mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-24 03:29:28 +01:00
add rank test to factoids, update factoids test code to sqlite3
This commit is contained in:
parent
0fb4dd6dff
commit
2e043ce19f
@ -31,11 +31,10 @@
|
|||||||
from supybot.test import *
|
from supybot.test import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import sqlite
|
import sqlite3
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sqlite = None
|
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
||||||
|
|
||||||
if sqlite:
|
|
||||||
class FactoidsTestCase(ChannelPluginTestCase):
|
class FactoidsTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Factoids',)
|
plugins = ('Factoids',)
|
||||||
def testRandomfactoid(self):
|
def testRandomfactoid(self):
|
||||||
@ -162,6 +161,13 @@ if sqlite:
|
|||||||
conf.supybot.plugins.Factoids.\
|
conf.supybot.plugins.Factoids.\
|
||||||
replyWhenInvalidCommand.setValue(orig)
|
replyWhenInvalidCommand.setValue(orig)
|
||||||
|
|
||||||
|
def testRank(self):
|
||||||
|
self.assertNotError('learn foo as bar')
|
||||||
|
self.assertNotError('learn moo as cow')
|
||||||
|
self.assertRegexp('factoids rank', '#1 foo \(0\), #2 moo \(0\)')
|
||||||
|
self.assertRegexp('whatis moo', '.*cow.*')
|
||||||
|
self.assertRegexp('factoids rank', '#1 moo \(1\), #2 foo \(0\)')
|
||||||
|
|
||||||
def testQuoteHandling(self):
|
def testQuoteHandling(self):
|
||||||
self.assertNotError('learn foo as "\\"bar\\""')
|
self.assertNotError('learn foo as "\\"bar\\""')
|
||||||
self.assertRegexp('whatis foo', r'"bar"')
|
self.assertRegexp('whatis foo', r'"bar"')
|
||||||
|
Loading…
Reference in New Issue
Block a user