def test_eval(self): self.client['a'] = 10 self.client['b'] = 9 self.client.script_flush() script = LuaScript(test_script_path, self.client) result = script.eval(keys=('a',), args=(2,)) self.assertEquals(result, 12) result = script.eval(keys=('b',), args=(5,)) self.assertEquals(result, 14)
def __init__(self, namespace, max_entries=1000, client=None): if client is None: client = redis.Redis() self._client = client self.namespace = namespace self.max_entries = max_entries script_path = LuaScript.script_path(self.script_name) self._script = LuaScript(script_path, self._client)
def test_script_path_classmethod(self): default_dir = os.path.dirname(scripting_module.__file__) path = LuaScript.script_path('example') self.assertEquals(path, os.path.join(default_dir, 'scripts', 'example.lua'))