当前位置: 首页>>代码示例>>Python>>正文


Python testing.check函数代码示例

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


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


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