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

Python fsfix.mk函数代码示例

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

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



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

示例1: 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:allisonmobley,项目名称:aspen,代码行数:7,代码来源:test_sockets_socket.py


示例2: test_can_put_onto_buffer

def test_can_put_onto_buffer():
    mk(('echo.sock.spt', '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:AlexisHuet,项目名称:aspen-python,代码行数:7,代码来源:test_sockets_buffer.py


示例3: 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:buchuki,项目名称:aspen,代码行数:7,代码来源:test_configuration.py


示例4: test_redirect_has_only_location

def test_redirect_has_only_location():
    mk(('index.html.spt', "from aspen import Response\n[---]\nrequest.redirect('http://elsewhere', code=304)\n[---]\n"))
    actual = handle()
    assert actual.code == 304
    headers = actual.headers
    assert len(headers) == 1, headers
    assert headers.get('Location') is not None, headers
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:7,代码来源:test_website.py


示例5: test_unavailable_knob_works

def test_unavailable_knob_works():
    mk( '.aspen'
      , ('.aspen/foo.py', 'bar = "baz"')
      , ('index.html', "import fooGreetings, {{ foo.bar }}!")
       )
    actual = handle('/', '--unavailable=1').code
    assert actual == 503, actual
开发者ID:sanyaade-webdev,项目名称:aspen,代码行数:7,代码来源:test_website.py


示例6: 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:buchuki,项目名称:aspen,代码行数:7,代码来源:test_configuration.py


示例7: test_www_root_defaults_to_cwd

def test_www_root_defaults_to_cwd():
    mk()
    c = Configurable()
    c.configure([])
    expected = os.path.realpath(os.getcwd())
    actual = c.www_root
    assert actual == expected, actual
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:7,代码来源:test_configuration.py


示例8: 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:rayleyva,项目名称:aspen,代码行数:7,代码来源:test_sockets_buffer.py


示例9: test_resources_can_import_from_dot_aspen

def test_resources_can_import_from_dot_aspen():
    mk( '.aspen'
      , ('.aspen/foo.py', 'bar = "baz"')
      , ('index.html', "import fooGreetings, {{ foo.bar }}!")
       )
    expected = "Greetings, baz!"
    actual = handle('/', '--project_root=.aspen').body
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:8,代码来源:test_website.py


示例10: make_transport

def make_transport(content='', state=0):
    mk(('echo.sock', content))
    socket = make_socket()
    transport = XHRPollingTransport(socket)
    transport.timeout = 0.05 # for testing, could screw up the test
    if state == 1:
        transport.respond(Request(uri='/echo.sock'))
    return transport
开发者ID:jarpineh,项目名称:aspen,代码行数:8,代码来源:test_sockets_transport.py


示例11: test_channel_can_have_sockets_added_to_it

def test_channel_can_have_sockets_added_to_it():
    mk(('echo.sock', 'channel.send(channel.recv())'))
    socket = make_socket()
    channel = Channel('foo', ThreadedBuffer)
    channel.add(socket)

    expected = [socket]
    actual = list(channel)
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:9,代码来源:test_sockets_channel.py


示例12: test_two_sockets_are_instantiable

def test_two_sockets_are_instantiable():
    mk(('echo.sock', ''))

    socket1 = make_socket()
    socket2 = make_socket()

    expected = (Socket, Socket)
    actual = (socket1.__class__, socket2.__class__)
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:9,代码来源:test_sockets_socket.py


示例13: test_unavailable_knob_sets_retry_after_on_website

def test_unavailable_knob_sets_retry_after_on_website():
    mk( '.aspen'
      , ('.aspen/foo.py', 'bar = "baz"')
      , ('index.html', "import fooGreetings, {{ foo.bar }}!")
       )
    actual = handle('/', '--unavailable=10').headers['Retry-After']
    expected = datetime.datetime.utcnow().strftime('%a, %d %b %Y')
    assert actual.startswith(expected), actual
    assert actual.endswith(' +0000'), actual
开发者ID:sanyaade-webdev,项目名称:aspen,代码行数:9,代码来源:test_website.py


示例14: test_path_part_params_are_available

def test_path_part_params_are_available():
    mk(('/foo/index.html.spt', """
if 'b' in path.parts[0].params:
    a = path.parts[0].params['a']
[---]
%(a)s"""))
    expected = "3"
    actual = handle('/foo;a=1;b;a=3/').body
    assert actual == expected, actual + " isn't " + expected
开发者ID:nejstastnejsistene,项目名称:aspen-python,代码行数:9,代码来源:test_resources.py


示例15: test_resources_can_import_from_dot_aspen

def test_resources_can_import_from_dot_aspen():
    mk( '.aspen'
      , ('.aspen/foo.py', 'bar = "baz"')
      , ('index.html.spt', "from foo import bar\n[---]\nGreetings, %(bar)s!")
       )
    expected = "Greetings, baz!"
    project_root = os.path.join(FSFIX, '.aspen')
    actual = handle('/', '--project_root='+project_root).body
    assert actual == expected, actual
开发者ID:Web5design,项目名称:aspen-python,代码行数:9,代码来源:test_website.py


示例16: test_double_failure_still_sets_response_dot_request

def test_double_failure_still_sets_response_dot_request():
    mk( '.aspen'
      , ('.aspen/foo.py', """
def bar(response):
    response.request
""")
      , ('.aspen/hooks.conf', 'foo:bar')
      , ('index.html', "raise heck")
       )
开发者ID:buchuki,项目名称:aspen,代码行数:9,代码来源:test_website.py


示例17: test_socket_can_barely_function

def test_socket_can_barely_function():
    mk(('echo.sock', 'socket.send("Greetings, program!")'))

    socket = make_socket()
    socket.tick()

    expected = FFFD+'33'+FFFD+'3::/echo.sock:Greetings, program!'
    actual = socket._recv().next()
    assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:9,代码来源:test_sockets_socket.py


示例18: test_socket_can_echo

def test_socket_can_echo():
    mk(('echo.sock', 'socket.send(socket.recv())'))

    with SocketInThread() as socket:
        socket._send('3::/echo.sock:Greetings, program!')
        time.sleep(0.05) # give the resource time to tick

        expected = FFFD+'33'+FFFD+'3::/echo.sock:Greetings, program!'
        actual = socket._recv().next()
        assert actual == expected, actual
开发者ID:jarpineh,项目名称:aspen,代码行数:10,代码来源:test_sockets_socket.py


示例19: test_ConfigurationError_NOT_raised_if_no_cwd_but_do_have___root

def test_ConfigurationError_NOT_raised_if_no_cwd_but_do_have___root():
    mk()
    foo = os.getcwd()
    os.chdir(FSFIX)
    os.rmdir(os.getcwd())
    c = Configurable()
    c.configure(['--root', foo])
    expected = foo
    actual = c.root
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:10,代码来源:test_configuration.py


示例20: test_channel_passes_send_on_to_one_socket

def test_channel_passes_send_on_to_one_socket():
    mk(('echo.sock', ''))
    socket = make_socket()
    channel = Channel('foo', ThreadedBuffer)
    channel.add(socket)
    channel.send('foo')

    expected = deque([Message.from_bytes('3::/echo.sock:foo')])
    actual = socket.outgoing.queue
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:10,代码来源:test_sockets_channel.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python fsfix.mk函数代码示例发布时间:2022-05-24
下一篇:
Python client.Client类代码示例发布时间: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