assert host == "localhost" s = "test" nick, ident, host = parseprefix(s) assert nick == "test" assert ident is None assert host is None @pytest.mark.parametrize("event,data", [ (PASS("secret"), b"PASS secret\r\n"), (USER("foo", "localhost", "localhost", "Test Client"), b"USER foo localhost localhost :Test Client\r\n"), (NICK("test"), b"NICK test\r\n"), (PONG("localhost"), b"PONG :localhost\r\n"), (QUIT(), b"QUIT Leaving\r\n"), (QUIT("Test"), b"QUIT Test\r\n"), (QUIT("Test Message"), b"QUIT :Test Message\r\n"), (JOIN("#test"), b"JOIN #test\r\n"), (JOIN("#test", "secret"), b"JOIN #test secret\r\n"), (PART("#test"), b"PART #test\r\n"), (PRIVMSG("test", "Hello"), b"PRIVMSG test Hello\r\n"), (PRIVMSG("test", "Hello World"), b"PRIVMSG test :Hello World\r\n"), (NOTICE("test", "Hello"), b"NOTICE test Hello\r\n"), (NOTICE("test", "Hello World"), b"NOTICE test :Hello World\r\n"), (KICK("#test", "test"), b"KICK #test test :\r\n"), (KICK("#test", "test", "Bye"), b"KICK #test test Bye\r\n"), (KICK("#test", "test", "Good Bye!"), b"KICK #test test :Good Bye!\r\n"), (TOPIC("#test", "Hello World!"), b"TOPIC #test :Hello World!\r\n"), (MODE("+i"), b"MODE +i\r\n"), (MODE("#test", "+o", "test"), b"MODE #test +o test\r\n"),
def signal(self, event, signo, stack): if signo == signal.SIGINT: for client in self.servers.values(): client.fire(QUIT('Keyboard interrupt'))
def remove_server(self, server, message='Leaving!'): for client in self.servers.values(): if client.channel == server: client.fire(QUIT(message)) return client
def __call__(self, args): self._commander.fire(QUIT(' '.join(args.message)), args.ircserver.channel) return 'Okay, going to exit!'
def cmdQUIT(self, message="Bye"): self.fire(QUIT(message))
def cmdEXIT(self, message=""): self.fire(QUIT(message)) raise SystemExit(0)