How to use the lupa._lupa.LuaRuntime function in lupa

To help you get started, we’ve selected a few lupa 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 Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_with_command_error_call():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)

    with pytest.raises(RedisScriptError) as exc:
        redis_lua.call('cmd_not_found')

    assert str(exc.value) == '@user_script: Unknown Redis command called from Lua script'
github Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_with_error_call():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)

    with pytest.raises(RedisScriptError) as exc:
        redis_lua.call('GET')

    assert str(exc.value) == "wrong number of arguments for 'get' command"
github Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_with_command_error_pcall():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)
    table = redis_lua.pcall('cmd_not_found')

    assert table['err'] == '@user_script: Unknown Redis command called from Lua script'
github Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_return_lua_types_pcall():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)
    lua_script = """return {'test', true, false, 10, 20.3, {'another string'}, redis.call('ping')}"""
    table = redis_lua.pcall('EVAL', lua_script, 0, [])

    assert table[1] == 'test'
    assert table[2] == 1
    assert table[3] is False
    assert table[4] == 10
    assert table[5] == 20
    assert table[6][1] == 'another string'
    assert table[7] == 'PONG'
github Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_with_error_pcall():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)
    table = redis_lua.pcall('GET')

    assert table['err'] == "wrong number of arguments for 'get' command"
github Yipit / dredis / tests / unit / test_lua.py View on Github external
def test_redislua_return_lua_types_call():
    k = Keyspace()
    lua_runtime = LuaRuntime(unpack_returned_tuples=True)
    redis_lua = RedisLua(k, lua_runtime)
    lua_script = """return {'test', true, false, 10, 20.3, {'another string'}, redis.call('ping')}"""
    table = redis_lua.call('EVAL', lua_script, 0, [])

    assert table[1] == 'test'
    assert table[2] == 1
    assert table[3] is False
    assert table[4] == 10
    assert table[5] == 20
    assert table[6][1] == 'another string'
    assert table[7] == 'PONG'
github Yipit / dredis / dredis / lua.py View on Github external
def __init__(self, keyspace):
        self._runtime = LuaRuntime(unpack_returned_tuples=True)
        self._lua_table_type = type(self._runtime.table())
        self._redis_obj = RedisLua(keyspace, self._runtime)

lupa

Python wrapper around Lua and LuaJIT

MIT
Latest version published 1 month ago

Package Health Score

83 / 100
Full package analysis

Similar packages