本文整理汇总了Python中aspen.testing.fix函数的典型用法代码示例。如果您正苦于以下问题:Python fix函数的具体用法?Python fix怎么用?Python fix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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