How to use iredis - 10 common examples

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_index():
    from iredis.config import config

    config.raw = False
    raw = ["hello", "world", "foo"]
    out = renders._render_list([item.encode() for item in raw], raw)
    out = strip_formatted_text(out)
    assert isinstance(out, str)
    assert "3)" in out
    assert "1)" in out
    assert "4)" not in out
github laixintao / iredis / tests / test_client.py View on Github external
def test_get_server_verison_after_client():
    from iredis.config import config

    Client("127.0.0.1", "6379", None)
    assert config.version.startswith("5.")

    config.version = "Unknown"
    Client("127.0.0.1", "6379", None, get_info=False)
    assert config.version == "Unknown"
github laixintao / iredis / tests / test_completers.py View on Github external
def test_LUF_completer_touch():
    c = LatestUsedFirstWordCompleter(3, ["one", "two"])
    c.touch("hello")
    assert c.words == ["hello", "one", "two"]

    c.touch("foo")
    assert c.words == ["foo", "hello", "one"]

    c.touch("hello")
    assert c.words == ["hello", "foo", "one"]
github laixintao / iredis / tests / test_completers.py View on Github external
def test_LUF_completer_touch_words():
    c = LatestUsedFirstWordCompleter(3, [])
    c.touch_words(["hello", "world", "foo", "bar"])
    assert c.words == ["bar", "foo", "world"]

    c.touch_words(["one", "two"])
    assert c.words == ["two", "one", "bar"]
github laixintao / iredis / tests / test_client.py View on Github external
def test_get_server_verison_after_client():
    from iredis.config import config

    Client("127.0.0.1", "6379", None)
    assert config.version.startswith("5.")

    config.version = "Unknown"
    Client("127.0.0.1", "6379", None, get_info=False)
    assert config.version == "Unknown"
github laixintao / iredis / tests / test_client.py View on Github external
def test_do_help():
    from iredis.config import config

    client = Client("127.0.0.1", "6379", None)
    config.version = "5.0.0"
    resp = client.do_help("SET")
    assert resp[10] == ("", "1.0.0 (Avaiable on your redis-server: 5.0.0)")
    config.version = "2.0.0"
    resp = client.do_help("cluster", "addslots")
    assert resp[10] == ("", "3.0.0 (Not avaiable on your redis-server: 2.0.0)")
github laixintao / iredis / tests / test_client.py View on Github external
def test_do_help():
    from iredis.config import config

    client = Client("127.0.0.1", "6379", None)
    config.version = "5.0.0"
    resp = client.do_help("SET")
    assert resp[10] == ("", "1.0.0 (Avaiable on your redis-server: 5.0.0)")
    config.version = "2.0.0"
    resp = client.do_help("cluster", "addslots")
    assert resp[10] == ("", "3.0.0 (Not avaiable on your redis-server: 2.0.0)")
github laixintao / iredis / tests / test_client.py View on Github external
def test_get_server_verison_after_client():
    from iredis.config import config

    Client("127.0.0.1", "6379", None)
    assert config.version.startswith("5.")

    config.version = "Unknown"
    Client("127.0.0.1", "6379", None, get_info=False)
    assert config.version == "Unknown"
github laixintao / iredis / tests / test_render_functions.py View on Github external
def test_render_members_config_raw(completer):
    completer.completers["members"].words = []
    config.raw = True
    config.withscores = True
    rendered = renders.render_members([b"duck", b"667", b"camel", b"708"], completer)

    assert rendered == b"duck\n667\ncamel\n708"
    assert completer.completers["member"].words == ["camel", "duck"]