'Tags with values containing invalid characters passed to
L{IRC.sendCommand} are escaped.'

def test_sendCommandValidateTagValueEscaping(self):

    sendTags = {u'aaa': u'bbb', u'ccc': u'test\r\n    \\;;'}
    expectedTags = ('aaa=bbb', 'ccc=test\\r\\n\\s\\\\\\:\\:')
    self.p.sendCommand(u'CMD', (u'param1', u'param2'), u'irc.example.com', sendTags)
    outMsg = self.f.getvalue()
    (outTagStr, outLine) = outMsg.split('    ', 1)
    outTags = outTagStr[1:].split(';')
    self.assertEqual(sorted(outTags), sorted(expectedTags))
