def test_access_formatter_exc_colour():
    f = AccessFormatter()
    f.stream_is_tty = True
    try:
        raise RuntimeError('testing')
    except RuntimeError:
        stack = f.formatException(sys.exc_info())
        assert stack.startswith('\x1b[38;5;26mTraceback')
def test_access_formatter_colour():
    f = AccessFormatter()
    f.stream_is_tty = True
    msg = json.dumps({
        'time': '_time_',
        'prefix': '_p_',
        'msg': '_msg_',
        'dim': False
    })
    assert f.format(_mk_record(
        msg)) == '\x1b[35m_time_\x1b[0m \x1b[34m_p_\x1b[0m \x1b[0m_msg_\x1b[0m'