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

Python testing.check函数代码示例

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

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



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

示例1: test_json_defaults_to_application_json_for_static_json

def test_json_defaults_to_application_json_for_static_json():
    expected = 'application/json'
    actual = check( '{"Greetings": "program!"}'
                  , filename="foo.json"
                  , body=False
                   ).headers['Content-Type']
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:7,代码来源:test_json_resource.py


示例2: test_charset_dynamic_barely_working

def test_charset_dynamic_barely_working():
    response = check( "^LGreetings, program!", 'index.html', False
                    , argv=['--charset_dynamic=CHEESECODE']
                     )
    expected = 'text/html; charset=CHEESECODE'
    actual = response.headers['Content-Type']
    assert actual == expected, actual
开发者ID:alexcouper,项目名称:aspen,代码行数:7,代码来源:test_resources.py


示例3: test_json_defaults_to_application_json_for_dynamic_json

def test_json_defaults_to_application_json_for_dynamic_json():
    expected = 'application/json'
    actual = check( "response.body = {'Greetings': 'program!'}"
                  , filename="foo.json"
                  , body=False
                   ).headers['Content-Type']
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:7,代码来源:test_json_resource.py


示例4: test_json_content_type_is_configurable_for_static_json

def test_json_content_type_is_configurable_for_static_json():
    configure_aspen_py = 'website.media_type_json = "floober/blah"'
    expected = "floober/blah"
    actual = check(
        '{"Greetings": "program!"}', filename="foo.json", body=False, configure_aspen_py=configure_aspen_py
    ).headers["Content-Type"]
    assert actual == expected
开发者ID:ric03uecS,项目名称:aspen-python,代码行数:7,代码来源:test_json_resource.py


示例5: test_charset_static_barely_working

def test_charset_static_barely_working():
    response = check( "Greetings, program!", 'index.html', False
                    , argv=['--charset_static=OOG']
                     )
    expected = 'text/html; charset=OOG'
    actual = response.headers['Content-Type']
    assert actual == expected
开发者ID:prodigeni,项目名称:aspen-python,代码行数:7,代码来源:test_resources.py


示例6: test_unknown_mimetype_yields_default_mimetype

def test_unknown_mimetype_yields_default_mimetype():
    response = check( "Greetings, program!"
                    , body=False
                    , filename="foo.flugbaggity"
                     )
    expected = "text/plain"
    actual = response.headers['Content-Type']
    assert actual == expected, actual
开发者ID:alexcouper,项目名称:aspen,代码行数:8,代码来源:test_resources.py


示例7: test_json_handles_unicode

def test_json_handles_unicode():
    expected = b'''{
    "Greetings": "\u00b5"
}'''
    actual = check( "[---]\nresponse.body = {'Greetings': unichr(181)}"
                  , filename="foo.json.spt"
                   )
    assert actual == expected, actual
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:8,代码来源:test_json_resource.py


示例8: test_json_basically_works

def test_json_basically_works():
    expected = '''{
    "Greetings": "program!"
}'''
    actual = check( "[---]\nresponse.body = {'Greetings': 'program!'}"
                  , filename="foo.json.spt"
                   )
    assert actual == expected, actual
开发者ID:ArmstrongJ,项目名称:aspen-python,代码行数:8,代码来源:test_json_resource.py


示例9: test_json_content_type_is_per_file_configurable

def test_json_content_type_is_per_file_configurable():
    expected = "floober/blah"
    actual = check(
        "[---]\nresponse.body = {'Greetings': 'program!'}\nresponse.headers['Content-Type'] = 'floober/blah'\n",
        filename="foo.json.spt",
        body=False,
    ).headers["Content-Type"]
    assert actual == expected
开发者ID:ric03uecS,项目名称:aspen-python,代码行数:8,代码来源:test_json_resource.py


示例10: test_json_handles_time

def test_json_handles_time():
    expected = '{"seen": "19:30:00"}'
    actual = check( "import datetime"
                  + ""
                  + "response.body = {'seen': datetime.time(19, 30)}"
                  , filename="foo.json"
                   )
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:8,代码来源:test_json_resource.py


示例11: test_json_handles_date

def test_json_handles_date():
    expected = '{"created": "2011-05-09"}'
    actual = check( "import datetime"
                  + ""
                  + "response.body = {'created': datetime.date(2011, 5, 9)}"
                  , filename="foo.json"
                   )
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:8,代码来源:test_json_resource.py


示例12: test_json_content_type_is_configurable_from_the_command_line

def test_json_content_type_is_configurable_from_the_command_line():
    expected = 'floober/blah'
    actual = check( '{"Greetings": "program!"}'
                  , filename="foo.json"
                  , body=False
                  , argv=['--media_type_json=floober/blah']
                   ).headers['Content-Type']
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:8,代码来源:test_json_resource.py


示例13: test_website_is_in_context

def test_website_is_in_context():
    expected = "It worked."
    actual = check("""\
assert website.__class__.__name__ == 'Website', website


It worked.""")
    assert actual == expected, actual
开发者ID:alexcouper,项目名称:aspen,代码行数:8,代码来源:test_resources.py


示例14: test_json_handles_datetime

def test_json_handles_datetime():
    expected = '{"timestamp": "2011-05-09T00:00:00"}'
    actual = check( "import datetime"
                  + ""
                  + "response.body = { 'timestamp'"
                  + "                : datetime.datetime(2011, 5, 9, 0, 0)}"
                  , filename="foo.json"
                   )
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:9,代码来源:test_json_resource.py


示例15: test_json_content_type_is_configurable_for_static_json

def test_json_content_type_is_configurable_for_static_json():
    aspenconf = '[aspen]\njson_content_type: floober/blah'
    expected = 'floober/blah'
    actual = check( '{"Greetings": "program!"}'
                  , filename="foo.json"
                  , body=False
                  , aspenconf=aspenconf
                   ).headers.one('Content-Type')
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:9,代码来源:test_json_resources.py


示例16: test_json_content_type_is_configurable_for_dynamic_json

def test_json_content_type_is_configurable_for_dynamic_json():
    aspenconf = '[aspen]\njson_content_type: floober/blah'
    expected = 'floober/blah'
    actual = check( "response.body = {'Greetings': 'program!'}"
                  , filename="foo.json"
                  , body=False
                  , aspenconf=aspenconf
                   ).headers.one('Content-Type')
    assert actual == expected, actual
开发者ID:buchuki,项目名称:aspen,代码行数:9,代码来源:test_json_resources.py


示例17: test_json_handles_date

def test_json_handles_date():
    expected = """{
    "created": "2011-05-09"
}"""
    actual = check(
        "import datetime\n" + "[---------------]\n" + "response.body = {'created': datetime.date(2011, 5, 9)}",
        filename="foo.json.spt",
    )
    assert actual == expected
开发者ID:ric03uecS,项目名称:aspen-python,代码行数:9,代码来源:test_json_resource.py


示例18: test_json_handles_time

def test_json_handles_time():
    expected = """{
    "seen": "19:30:00"
}"""
    actual = check(
        "import datetime\n" + "[---------------]\n" + "response.body = {'seen': datetime.time(19, 30)}",
        filename="foo.json.spt",
    )
    assert actual == expected
开发者ID:ric03uecS,项目名称:aspen-python,代码行数:9,代码来源:test_json_resource.py


示例19: test_templating_without_script_works

def test_templating_without_script_works():
    response = Response()
    expected = "index.html"

    # I want a slash on the front of index.html but it's an artifact of
    # StubRequest that we don't get one.

    actual = check("[-----] via stdlib_format\n{request.line.uri.path.raw}", response=response)
    assert actual == expected, actual
开发者ID:Web5design,项目名称:aspen-python,代码行数:9,代码来源:test_resources.py


示例20: test_json_content_type_is_configurable_for_dynamic_json

def test_json_content_type_is_configurable_for_dynamic_json():
    configure_aspen_py = 'website.media_type_json = "floober/blah"'
    expected = 'floober/blah'
    actual = check( "response.body = {'Greetings': 'program!'}"
                  , filename="foo.json"
                  , body=False
                  , configure_aspen_py=configure_aspen_py
                   ).headers['Content-Type']
    assert actual == expected, actual
开发者ID:allisonmobley,项目名称:aspen,代码行数:9,代码来源:test_json_resource.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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