mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-16 05:30:44 +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 *
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
||||
|
||||
if sqlite:
|
||||
class FactoidsTestCase(ChannelPluginTestCase):
|
||||
plugins = ('Factoids',)
|
||||
def testRandomfactoid(self):
|
||||
@ -162,6 +161,13 @@ if sqlite:
|
||||
conf.supybot.plugins.Factoids.\
|
||||
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):
|
||||
self.assertNotError('learn foo as "\\"bar\\""')
|
||||
self.assertRegexp('whatis foo', r'"bar"')
|
||||
|
Loading…
x
Reference in New Issue
Block a user