Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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"'
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""
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)"
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"
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)"),