当前位置: 首页>>代码示例>>Python>>正文


Python testing.mk函数代码示例

本文整理汇总了Python中aspen.testing.mk函数的典型用法代码示例。如果您正苦于以下问题:Python mk函数的具体用法?Python mk怎么用?Python mk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mk函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_aspen_favicon_doesnt_get_clobbered_by_virtual_path

def test_aspen_favicon_doesnt_get_clobbered_by_virtual_path():
    mk('%value')
    request = StubRequest.from_fs('/favicon.ico')
    gauntlet.run_through(request, gauntlet.not_found)
    expected = {}
    actual = request.line.uri.path
    assert actual == expected, actual
开发者ID:rayleyva,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例2: test_virtual_path_docs_1

def test_virtual_path_docs_1():
    mk(('%name/index.html.spt', GREETINGS_NAME_SPT))
    expected = "Greetings, aspen!"
    #import pdb; pdb.set_trace()
    response = handle('/aspen/')
    actual = response.body
    assert actual == expected, repr(actual) + " from " + repr(response)
开发者ID:Web5design,项目名称:aspen-python,代码行数:7,代码来源:test_dispatcher.py

示例3: test_trailing_slash_redirects_trailing_slash_to_the_right_place

def test_trailing_slash_redirects_trailing_slash_to_the_right_place():
    mk("foo")
    response = assert_raises(Response, check_trailing_slash, "/foo")

    expected = "/foo/"
    actual = response.headers["Location"]
    assert actual == expected, actual
开发者ID:sanyaade-webdev,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例4: test_virtual_path_file_not_dir

def test_virtual_path_file_not_dir():
    mk( ('%foo/bar.html', "Greetings from bar!")
      , ('%baz.html', "Greetings from baz!")
       )
    actual = check_virtual_paths('/bal.html').fs
    expected = fix('%baz.html')
    assert actual == expected, actual
开发者ID:rayleyva,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例5: test_alternate_index_is_found

def test_alternate_index_is_found():
    mk( ('.aspen/aspen.conf', '[aspen]\ndefault_filenames = default.html')
      , ('default.html', "Greetings, program!")
       )
    expected = fix('default.html')
    actual = check_index('/').fs
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例6: test_index_conf_setting_overrides_and_doesnt_extend

def test_index_conf_setting_overrides_and_doesnt_extend():
    mk( ('.aspen/aspen.conf', '[aspen]\ndefault_filenames = default.html')
      , ('index.html', "Greetings, program!")
       )
    expected = fix('')
    actual = check_index('/').fs
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例7: test_tornado_obeys_changes_reload_for_meta

def test_tornado_obeys_changes_reload_for_meta():
    mk(("base.html", "{% block foo %}{% end %} Blam."))
    make_renderer = tornado_factory_factory(["--project_root", FSFIX, "--changes_reload=yes"])
    open(fix("base.html"), "w+").write("{% block foo %}{% end %} Blar.")
    render = make_renderer("<string>", "{% extends base.html %}" "{% block foo %}Some bytes!{% end %}")
    actual = render({})
    assert actual == "Some bytes! Blar.", actual
开发者ID:alexcouper,项目名称:aspen,代码行数:7,代码来源:test_rendering.py

示例8: test_tornado_caches_by_default

def test_tornado_caches_by_default():
    mk(("base.html", "{% block foo %}{% end %} Blam."))
    make_renderer = tornado_factory_factory(["--project_root", FSFIX])
    render = make_renderer("<string>", "{% extends base.html %}" "{% block foo %}Some bytes!{% end %}")
    open(fix("base.html"), "w+").write("{% block foo %}{% end %} Blar.")
    actual = render({})
    assert actual == "Some bytes! Blam.", actual
开发者ID:alexcouper,项目名称:aspen,代码行数:7,代码来源:test_rendering.py

示例9: test_all_six

def test_all_six():
    mk(('foo.conf', """

        random:choice
        random:sample 
        random:randint
        
        random:random
        random:gauss
        random:choice
        random:shuffle

        

        Ignored!

        """) )
    expected = [ [random.choice, random.sample]
               , [random.randint]
               , [random.random, random.gauss]
               , [random.choice, random.shuffle]
               , []
               , []
                ]
    actual = load('foo.conf')
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:26,代码来源:test_hooks.py

示例10: test_virtual_path__and_indirect_neg_file_not_dir

def test_virtual_path__and_indirect_neg_file_not_dir():
    mk( ('%foo/bar.html', "Greetings from bar!")
      , ('%baz.spt', "Greetings from baz!")
       )
    expected = fix('%baz.spt')
    actual = check('/bal.html').fs
    assert actual == expected, actual
开发者ID:nejstastnejsistene,项目名称:aspen-python,代码行数:7,代码来源:test_dispatcher.py

示例11: test_can_override_default_renderer_entirely

def test_can_override_default_renderer_entirely():
    mk(('.aspen/configure-aspen.py', OVERRIDE_SIMPLATE),
       ('index.spt', NEGOTIATED_RESOURCE))
    request = StubRequest.from_fs('index.spt')
    request.headers['Accept'] = 'text/plain'
    actual = get_response(request, Response()).body
    assert actual == "glubber", actual
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:7,代码来源:test_negotiated_resource.py

示例12: test_tornado_loader_shim_resolves_path_from_absolute_nested_parent_path

def test_tornado_loader_shim_resolves_path_from_absolute_nested_parent_path():
    mk(("base.html", "Resolved."), "www")
    make_renderer = tornado_factory_factory(["--project_root", FSFIX])
    path = os.path.abspath(os.path.join(FSFIX, convert_path("www/index.html")))
    render = make_renderer(path, "{% extends base.html %}")
    actual = render({})
    assert actual == "Resolved.", actual
开发者ID:AlexisHuet,项目名称:aspen-python,代码行数:7,代码来源:test_rendering.py

示例13: test_configure_aspen_py_setting_override_works_too

def test_configure_aspen_py_setting_override_works_too():
    mk( ('.aspen/configure-aspen.py', 'website.indices = ["default.html"]')
      , ('index.html', "Greetings, program!")
       )
    expected = fix('')
    actual = check_index('/').fs
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例14: test_file_with_no_extension_matches

def test_file_with_no_extension_matches():
    mk( ('%value', '{"Greetings,": "program!"}')
      , ('value', '{"Greetings,": "program!"}')
       )
    expected = {'value': [u'baz']}
    actual = check_virtual_paths('/baz').line.uri.path
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py

示例15: test_file_matches_in_face_of_dir

def test_file_matches_in_face_of_dir():
    mk( ('%page/index.html', 'Nothing to see here.')
      , ('%value.txt', "Greetings, program!")
       )
    expected = {'value': [u'baz']}
    actual = check_virtual_paths('/baz.txt').line.uri.path
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py


注:本文中的aspen.testing.mk函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。