mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-22 18:39:31 +01:00
Fix the tests for mircColor and sorted (Thanks dcraven)
This commit is contained in:
parent
a8a7ec56d1
commit
5c197471c6
@ -109,10 +109,10 @@ class FunctionsTestCase(SupyTestCase):
|
||||
# Test positional args
|
||||
self.assertEqual('\x0300foo\x03', ircutils.mircColor(s, 'white'))
|
||||
self.assertEqual('\x031,02foo\x03',ircutils.mircColor(s,'black','blue'))
|
||||
self.assertEqual('\x03,03foo\x03', ircutils.mircColor(s, None, 'green'))
|
||||
self.assertEqual('\x0300,03foo\x03', ircutils.mircColor(s, None, 'green'))
|
||||
# Test keyword args
|
||||
self.assertEqual('\x0304foo\x03', ircutils.mircColor(s, fg='red'))
|
||||
self.assertEqual('\x03,05foo\x03', ircutils.mircColor(s, bg='brown'))
|
||||
self.assertEqual('\x0300,05foo\x03', ircutils.mircColor(s, bg='brown'))
|
||||
self.assertEqual('\x036,07foo\x03',
|
||||
ircutils.mircColor(s, bg='orange', fg='purple'))
|
||||
|
||||
@ -203,8 +203,8 @@ class FunctionsTestCase(SupyTestCase):
|
||||
self.failIf(ircutils.isNick('foo bar'))
|
||||
finally:
|
||||
conf.supybot.protocols.irc.strictRfc.setValue(original)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def testBanmask(self):
|
||||
for msg in msgs:
|
||||
@ -229,7 +229,7 @@ class FunctionsTestCase(SupyTestCase):
|
||||
def testNickFromHostmask(self):
|
||||
self.assertEqual(ircutils.nickFromHostmask('nick!user@host.domain.tld'),
|
||||
'nick')
|
||||
|
||||
|
||||
def testToLower(self):
|
||||
self.assertEqual('jemfinch', ircutils.toLower('jemfinch'))
|
||||
self.assertEqual('{}|^', ircutils.toLower('[]\\~'))
|
||||
|
@ -136,11 +136,11 @@ class GenTest(SupyTestCase):
|
||||
|
||||
def testSorted(self):
|
||||
L = ['a', 'c', 'b']
|
||||
self.assertEqual(utils.sorted(L), ['a', 'b', 'c'])
|
||||
self.assertEqual(sorted(L), ['a', 'b', 'c'])
|
||||
self.assertEqual(L, ['a', 'c', 'b'])
|
||||
def mycmp(x, y):
|
||||
return -cmp(x, y)
|
||||
self.assertEqual(utils.sorted(L, mycmp), ['c', 'b', 'a'])
|
||||
self.assertEqual(sorted(L, mycmp), ['c', 'b', 'a'])
|
||||
|
||||
def testTimeElapsed(self):
|
||||
self.assertRaises(ValueError, utils.timeElapsed, 0,
|
||||
@ -391,7 +391,7 @@ class IterTest(SupyTestCase):
|
||||
self.assertEqual([0, 1], list(utils.iter.limited(L, 2)))
|
||||
self.assertEqual(range(10), list(utils.iter.limited(L, 10)))
|
||||
self.assertRaises(ValueError, list, utils.iter.limited(L, 11))
|
||||
|
||||
|
||||
def testRandomChoice(self):
|
||||
choice = utils.iter.choice
|
||||
self.assertRaises(IndexError, choice, {})
|
||||
|
Loading…
Reference in New Issue
Block a user