'L{IRCClient.ping}'

def test_ping(self):

    self.protocol.ping('otheruser')
    self.assertTrue(self.transport.value().startswith('PRIVMSG    otheruser    :\x01PING'))
    self.transport.clear()
    self.protocol.ping('otheruser', 'are    you    there')
    self.assertEqual(self.transport.value(), 'PRIVMSG    otheruser    :\x01PING    are    you    there\x01\r\n')
    self.transport.clear()
    self.protocol._pings = {}
    for pingNum in range((self.protocol._MAX_PINGRING + 3)):
        self.protocol._pings[('otheruser', str(pingNum))] = (time.time() + pingNum)
    self.assertEqual(len(self.protocol._pings), (self.protocol._MAX_PINGRING + 3))
    self.protocol.ping('otheruser', 'I    sent    a    lot    of    pings')
    self.assertEqual(len(self.protocol._pings), self.protocol._MAX_PINGRING)
    self.assertEqual(self.transport.value(), 'PRIVMSG    otheruser    :\x01PING    I    sent    a    lot    of    pings\x01\r\n')
