Beispiel #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()))
Beispiel #2
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()))
Beispiel #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,
    )
Beispiel #4
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,
    )