本文整理汇总了Python中aspen.testing.fix函数的典型用法代码示例。如果您正苦于以下问题:Python fix函数的具体用法?Python fix怎么用?Python fix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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
示例2: 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
示例3: test_alternate_index_is_found
def test_alternate_index_is_found():
mk( ('.aspen/configure-aspen.py', 'website.indices += ["default.html"]')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: test_index_conf_setting_works_with_only_comma
def test_index_conf_setting_works_with_only_comma():
mk( ( '.aspen/aspen.conf'
, '[aspen]\ndefault_filenames: index.html,default.html')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例11: test_index_conf_setting_ignores_blanks
def test_index_conf_setting_ignores_blanks():
mk( ( '.aspen/aspen.conf'
, '[aspen]\ndefault_filenames: index.html,, ,, ,,, default.html')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例12: test_index_conf_setting_takes_second_if_first_is_missing
def test_index_conf_setting_takes_second_if_first_is_missing():
mk( ( '.aspen/aspen.conf'
, '[aspen]\ndefault_filenames = index.html default.html')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例13: test_configure_aspen_py_setting_strips_commas
def test_configure_aspen_py_setting_strips_commas():
mk( ( '.aspen/configure-aspen.py'
, 'website.indices = ["index.html", "default.html"]')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例14: test_configure_aspen_py_setting_takes_second_if_first_is_missing
def test_configure_aspen_py_setting_takes_second_if_first_is_missing():
mk( ( '.aspen/configure-aspen.py'
, 'website.indices = ["index.html", "default.html"]')
, ('default.html', "Greetings, program!")
)
expected = fix('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例15: test_configure_aspen_py_setting_takes_first
def test_configure_aspen_py_setting_takes_first():
mk(
(".aspen/configure-aspen.py", 'website.indices = ["index.html", "default.html"]'),
("index.html", "Greetings, program!"),
("default.html", "Greetings, program!"),
)
expected = fix("index.html")
actual = check_index("/").fs
assert actual == expected, actual
开发者ID:sanyaade-webdev,项目名称:aspen,代码行数:9,代码来源:test_gauntlet.py
示例16: test_negotiated_index_is_found
def test_negotiated_index_is_found():
mk(( 'index'
, """\
^L text/html
<h1>Greetings, program!</h1>
^L text/plain
Greetings, program!
"""))
expected = fix('index')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:11,代码来源:test_gauntlet.py
示例17: test_dont_redirect_second_index_if_first
def test_dont_redirect_second_index_if_first():
mk( ( '.aspen/configure-aspen.py'
, 'website.indices = ["index.html", "default.html"]')
, ('default.html', "Greetings, program!")
, ('index.html', "Greetings, program!")
)
# first index redirects
assert_raises_302(check, '/index.html')
# second shouldn't
expected = fix('default.html')
actual = check('/default.html').fs
assert actual == expected, actual
开发者ID:nejstastnejsistene,项目名称:aspen-python,代码行数:12,代码来源:test_dispatcher.py
示例18: test_configuration_script_can_set_renderer_default
def test_configuration_script_can_set_renderer_default():
CONFIG = """
website.renderer_default="stdlib_format"
"""
SIMPLATE = """
name="program"
[----]
Greetings, {name}!
"""
mk(
('.aspen/configure-aspen.py', CONFIG),
('index.html.spt', SIMPLATE)
)
w = Website(['--www_root', FSFIX, '-p', fix('.aspen'), '--show_tracebacks=yes'])
request = StubRequest(b'/')
request.website = w
response = w.handle_safely(request)
actual = response.body.strip()
expected = 'Greetings, program!'
assert actual == expected, actual
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:20,代码来源:test_configuration.py
示例19: test_virtual_path_is_virtual
def test_virtual_path_is_virtual():
mk(('%bar/foo.html', "Greetings, program!"))
expected = fix('%bar/foo.html')
actual = check_virtual_paths('/blah/foo.html').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:5,代码来源:test_gauntlet.py
示例20: test_alternate_index_is_not_found
def test_alternate_index_is_not_found():
mk(('default.html', "Greetings, program!"))
expected = fix('')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:5,代码来源:test_gauntlet.py
注:本文中的aspen.testing.fix函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论