示例#1
0
def test_unknown_formatting():
    try:
        utils.clean_formatting('\x19A01Wat')
        assert False, 'should have thrown an error'
    except NotImplementedError:
        # good
        pass
示例#2
0
文件: client.py 项目: wraithan/page
    def msg_sys_buffer_line_added(self, msg):
        """When a message is received, notify if appropriate."""

        # All lines, if they match the notify critera.

        for line in (l for l in msg[0]['values'] if self._should_notify(l)):
            buf_name = self.weechat_buffers[line['buffer']]
            notify(clean_formatting('{buf_name} - {prefix} - {message}'
                                    .format(buf_name=buf_name, **line)))
示例#3
0
文件: client.py 项目: atluxity/page
    def msg_sys_buffer_line_added(self, msg):
        """When a message is received, notify if appropriate."""

        # All lines, if they match the notify critera.

        for line in (l for l in msg[0]['values'] if self._should_notify(l)):
            buf_name = self.weechat_buffers[line['buffer']]
            notify(
                clean_formatting('{buf_name} - {prefix} - {message}'.format(
                    buf_name=buf_name, **line)))
示例#4
0
def test_clean_formatting():
    # One format
    eq_(utils.clean_formatting('Hey \x19F12you!'), 'Hey you!')
    # Two format
    eq_(utils.clean_formatting('\x19F20Hey \x19F12you!'), 'Hey you!')