本文整理汇总了Python中aspen.tests.fsfix.mk函数的典型用法代码示例。如果您正苦于以下问题:Python mk函数的具体用法?Python mk怎么用?Python mk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_layering
def test_layering():
mk(('first.conf', """
random:choice
random:sample
random:randint
"""),
('second.conf', """
random:random
random:gauss
random:choice
random:shuffle
""") )
expected = [ []
, [random.choice, random.sample, random.random, random.gauss]
, [random.randint, random.choice, random.shuffle]
, []
, []
, []
]
actual = load('fsfix/first.conf', 'fsfix/second.conf')
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:27,代码来源:test_hooks.py
示例2: 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('fsfix/foo.conf')
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:26,代码来源:test_hooks.py
示例3: test_configurable_sees_root_option
def test_configurable_sees_root_option():
mk()
c = Configurable()
c.configure(['--root', 'fsfix'])
expected = os.getcwd()
actual = c.root
assert actual == expected, actual
开发者ID:jatr,项目名称:aspen,代码行数:7,代码来源:test_configuration.py
示例4: 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 = expect('')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例5: test_can_put_onto_buffer
def test_can_put_onto_buffer():
mk(('echo.sock', 'socket.send(socket.recv())'))
buffer = Buffer(make_socket(), 'foo')
expected = [FFFD+'4'+FFFD+'1:::']
buffer.put(Message.from_bytes('1:::'))
actual = list(buffer.flush())
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:7,代码来源:test_sockets_buffer.py
示例6: 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': 'baz'}
actual = check_virtual_paths('/baz.html').path
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例7: test_barely_working
def test_barely_working():
mk(('index.html', "Greetings, program!"))
simplate = Simplate('index.html')
expected = 'text/html'
actual = simplate[0]
assert actual == expected, actual
开发者ID:falstaff84,项目名称:aspen,代码行数:7,代码来源:test_simplates.py
示例8: test_socket_can_shake_hands
def test_socket_can_shake_hands():
mk(('echo.sock', ''))
socket = make_socket()
response = socket.shake_hands()
expected = '15:10:xhr-polling'
actual = response.body.split(':', 1)[1]
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:7,代码来源:test_sockets_socket.py
示例9: test_root_defaults_to_cwd
def test_root_defaults_to_cwd():
mk()
c = Configurable()
c.configure([])
expected = os.getcwd()
actual = c.root
assert actual == expected, actual
开发者ID:jatr,项目名称:aspen,代码行数:7,代码来源:test_configuration.py
示例10: 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:berryp,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例11: test_file_with_no_extension_matches
def test_file_with_no_extension_matches():
mk( ('%value', '{"Greetings,": "program!"}')
, ('value', '{"Greetings,": "program!"}')
)
expected = {'value': 'baz'}
actual = check_virtual_paths('/baz').path
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例12: 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 = 'http://localhost/foo/'
actual = response.headers.one('Location')
assert actual == expected, actual
开发者ID:berryp,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例13: 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:berryp,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例14: 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 = expect('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例15: test_virtual_path_matches_the_first
def test_virtual_path_matches_the_first():
mk( ('%first/foo.html', "Greetings, program!")
, ('%second/foo.html', "WWAAAAAAAAAAAA!!!!!!!!")
)
expected = expect('%first/foo.html')
actual = check_virtual_paths('/1999/foo.html').fs
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:7,代码来源:test_gauntlet.py
示例16: test_virtual_path_docs_3
def test_virtual_path_docs_3():
mk( ('%name/index.html', "^L\nGreetings, {{ request.path['name'] }}!")
, ('%name/%cheese.txt', "^L\r\n{{ request.path['name'].title() }} likes {{ request.path['cheese'] }} cheese.")
)
response = handle('/chad/cheddar.txt')
expected = "Chad likes cheddar cheese."
actual = response.body
assert actual == expected, actual
开发者ID:falstaff84,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例17: test_simplates_can_import_from_dot_aspen
def test_simplates_can_import_from_dot_aspen():
mk( '.aspen'
, ('.aspen/foo.py', 'bar = "baz"')
, ('index.html', "import fooGreetings, {{ foo.bar }}!")
)
expected = "Greetings, baz!"
actual = handle().body
assert actual == expected, actual
开发者ID:falstaff84,项目名称:aspen,代码行数:8,代码来源:test_website.py
示例18: test_virtual_path_docs_4
def test_virtual_path_docs_4():
mk( ('%name/index.html', "Greetings, {{ request.path['name'] }}!")
, ('%name/%cheese.txt', "{{ request.path['name'].title() }} likes {{ request.path['cheese'] }} cheese.")
)
response = handle('/chad/cheddar.txt/')
expected = 404
actual = response.code
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
示例19: test_handle_barely_working
def test_handle_barely_working():
mk(('index.html', "Greetings, program!"))
request = StubRequest('index.html')
response = Response()
handle(request, response)
actual = response.body
expected = "Greetings, program!"
assert actual == expected, actual
开发者ID:dowski,项目名称:aspen,代码行数:8,代码来源:test_simplates.py
示例20: 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 = expect('default.html')
actual = check_index('/').fs
assert actual == expected, actual
开发者ID:geekbuntu,项目名称:aspen,代码行数:8,代码来源:test_gauntlet.py
注:本文中的aspen.tests.fsfix.mk函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论