Fix the tests for mircColor and sorted (Thanks dcraven)

This commit is contained in:
James Vega 2007-05-08 18:40:48 +00:00
parent a8a7ec56d1
commit 5c197471c6
2 changed files with 8 additions and 8 deletions

View File

@ -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('[]\\~'))

View File

@ -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, {})