Made safeArgument handle colors correctly.

This commit is contained in:
Jeremy Fincher 2003-08-01 23:48:02 +00:00
parent a4b6ee2028
commit 5ec5b997ca
2 changed files with 3 additions and 1 deletions

View File

@ -241,7 +241,7 @@ def isValidArgument(s):
"""Returns if s is strictly a valid argument for an IRC message."""
return '\r' not in s and '\n' not in s and '\x00' not in s
notFunky = string.ascii[32:]+'\x02'
notFunky = string.ascii[32:]+'\x02'+'\x03'
def safeArgument(s):
"""If s is unsafe for IRC, returns a safe version."""
if isValidArgument(s) and s.translate(string.ascii, notFunky) == '':

View File

@ -95,8 +95,10 @@ class FunctionsTestCase(unittest.TestCase):
def testSafeArgument(self):
s = 'I have been running for 9 seconds'
bolds = ircutils.bold(s)
colors = ircutils.mircColor(s, 'pink', 'orange')
self.assertEqual(s, ircutils.safeArgument(s))
self.assertEqual(bolds, ircutils.safeArgument(bolds))
self.assertEqual(colors, ircutils.safeArgument(colors))
def testIsIP(self):
self.failIf(ircutils.isIP('a.b.c'))