コード例 #1
0
def test_load_scripts_no_cache():
    names = ['sum', 'unicode']
    scripts = load_scripts(
        names=names,
        path=LUA_SEARCH_PATH,
    )

    assert_equal(set(names), {script.name for script in scripts.values()})
    assert_equal(set(names), set(scripts.keys()))
コード例 #2
0
ファイル: __init__.py プロジェクト: ereOn/redis-lua
def test_load_scripts_no_cache():
    names = ['sum', 'unicode']
    scripts = load_scripts(
        names=names,
        path=LUA_SEARCH_PATH,
    )

    assert_equal(set(names), {script.name for script in scripts.values()})
    assert_equal(set(names), set(scripts.keys()))
コード例 #3
0
def test_load_scripts_cache_hit():
    names = ['sum', 'foo']
    cache = {
        'foo': Script(
            name='foo',
            regions=[TextRegion(content='')],
        ),
    }
    scripts = load_scripts(
        names=names,
        path=LUA_SEARCH_PATH,
        cache=cache,
    )

    assert_equal(set(names), {script.name for script in scripts.values()})
    assert_equal(set(names), set(scripts.keys()))
    assert_equal(
        {
            'sum': scripts['sum'],
            'foo': scripts['foo'],
        },
        cache,
    )
コード例 #4
0
ファイル: __init__.py プロジェクト: ereOn/redis-lua
def test_load_scripts_cache_hit():
    names = ['sum', 'foo']
    cache = {
        'foo': Script(
            name='foo',
            regions=[TextRegion(content='')],
        ),
    }
    scripts = load_scripts(
        names=names,
        path=LUA_SEARCH_PATH,
        cache=cache,
    )

    assert_equal(set(names), {script.name for script in scripts.values()})
    assert_equal(set(names), set(scripts.keys()))
    assert_equal(
        {
            'sum': scripts['sum'],
            'foo': scripts['foo'],
        },
        cache,
    )