Пример #1
0
    def testColorizeNoSuchColor(self):
        """Some nonexistent colors"""
        greet = "Hello <puce>world"
        self.assertEqual(colorize(greet), greet)

        greet = "Hello <cerulean>world"
        self.assertEqual(colorize(greet), greet)
Пример #2
0
    def testColorizeSyntax(self):
        """Syntax cases"""
        # nesting
        greet = "Hello <<red>>world"
        self.assertEqual(colorize(greet), "Hello <\x035>world")

        # multiline
        greet = "Hello\n<red>world"
        self.assertEqual(colorize(greet), "Hello\n\x035world")

        # empty token handled ok
        greet = "Hello <>world"
        self.assertEqual(colorize(greet), greet)

        # extra spaces not allowed
        greet = "Hello < red >world"
        self.assertEqual(colorize(greet), greet)

        # case sensitive
        greet = "Hello <RED>world"
        self.assertEqual(colorize(greet), greet)
Пример #3
0
 def sendLine(self, line):
     line = colorize(line)
     line = line.encode('utf8')
     IRCClient.sendLine(self, line)
Пример #4
0
 def testColorize(self):
     """mIRC colors"""
     self.assertEqual(colorize("Hello <red>world"), "Hello \x035world")
     self.assertEqual(colorize("Hello <white>world"), "Hello \x030world")
     self.assertEqual(colorize("Hello <black>world"), "Hello \x031world")
Пример #5
0
 def sendLine(self, line):
     line = colorize(line)
     line = line.encode('utf8')
     basic.LineReceiver.sendLine(self, line)