How to use the iredis.renders.render_list function in iredis

To help you get started, we’ve selected a few iredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_list_with_nil_init():
    from iredis.config import config

    config.raw = False
    raw = [b"hello", None, b"world"]
    out = renders.render_list(raw, None)
    out = strip_formatted_text(out)
    assert out == '1) "hello"\n2) (nil)\n3) "world"'
github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_list_with_empty_list_raw():
    from iredis.config import config

    config.raw = True
    raw = []
    out = renders.render_list(raw, None)
    assert out == b""
github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_list_with_empty_list():
    from iredis.config import config

    config.raw = False
    raw = []
    out = renders.render_list(raw, None)
    out = strip_formatted_text(out)
    assert out == "(empty list or set)"
github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_list_with_nil_init_while_config_raw():
    from iredis.config import config

    config.raw = True
    raw = [b"hello", None, b"world"]
    out = renders.render_list(raw, None)
    assert out == b"hello\n\nworld"
github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_nested_list():
    text = [[b"get", 2, [b"readonly", b"fast"], 1, 1, 1]]
    config.raw = False
    assert renders.render_list(text, None) == FormattedText(
        [
            ("", "1)"),
            ("", " "),
            ("", "1)"),
            ("", " "),
            ("class:string", '"get"'),
            ("", "\n"),
            ("", "   "),
            ("", "2)"),
            ("", " "),
            ("class:string", '"2"'),
            ("", "\n"),
            ("", "   "),
            ("", "3)"),
            ("", " "),
            ("", "1)"),