• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testing.mk函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_file_matches_other_extension

def test_file_matches_other_extension():
    mk( ('%value.json', '{"Greetings,": "program!"}')
      , ('%value.txt', "Greetings, program!")
       )
    expected = "%value.txt"
    actual = os.path.basename(check_virtual_paths('/baz.txt').fs)
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py


示例17: test_virtual_path_matches_the_first

def test_virtual_path_matches_the_first():
    mk( ('%first/foo.html', "Greetings, program!")
      , ('%second/foo.html', "WWAAAAAAAAAAAA!!!!!!!!")
       )
    expected = fix('%first/foo.html')
    actual = check_virtual_paths('/1999/foo.html').fs
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py


示例18: test_trailing_slash_redirects_trailing_slash

def test_trailing_slash_redirects_trailing_slash():
    mk('foo')
    response = assert_raises(Response, check_trailing_slash, '/foo')

    expected = 301
    actual = response.code
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py


示例19: test_get_response_406_gives_list_of_acceptable_types

def test_get_response_406_gives_list_of_acceptable_types():
    mk(('index', NEGOTIATED_RESOURCE))
    request = StubRequest.from_fs('index')
    request.headers['Accept'] = 'cheese/head'
    actual = assert_raises(Response, get_response, request, Response()).body
    expected ="The following media types are available: text/plain, text/html."
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_negotiated_resource.py


示例20: test_indirect_negotiation_really_prefers_rendered

def test_indirect_negotiation_really_prefers_rendered():
    mk( ('foo.html', "Greetings, program!")
      , ('foo.', "blah blah blah")
       )
    expected = fix('foo.html')
    actual = check_indirect_negotiation('foo.html').fs
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testing.StubRequest类代码示例发布时间:2022-05-24
下一篇:
Python testing.handle函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap