Fixed a bug in stripFormatting.

This commit is contained in:
Jeremy Fincher 2004-08-08 02:07:11 +00:00
parent 3db50c1a2b
commit 127e9f3ccf
2 changed files with 3 additions and 1 deletions

View File

@ -317,8 +317,8 @@ def stripUnderline(s):
def stripFormatting(s):
"""Returns the string s, with all formatting removed."""
s = stripBold(s)
s = stripColor(s)
s = stripBold(s)
s = stripReverse(s)
s = stripUnderline(s)
return s.replace('\x0f', '').replace('\x0F', '')

View File

@ -153,6 +153,8 @@ class FunctionsTestCase(SupyTestCase):
self.assertEqual(ircutils.stripFormatting('\x02bold\x0302,04foo\x03'
'bar\x0f'),
'boldfoobar')
s = ircutils.mircColor('[', 'blue') + ircutils.bold('09:21')
self.assertEqual(ircutils.stripFormatting(s), '[09:21')
def testSafeArgument(self):
s = 'I have been running for 9 seconds'