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


Python tests.strict_eq函数代码示例

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


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

示例1: test_map_repr

def test_map_repr():
    m = r.Map([
        r.Rule(u'/wat', endpoint='enter'),
        r.Rule(u'/woop', endpoint='foobar')
    ])
    rv = repr(m)
    strict_eq(rv,
              "Map([<Rule '/woop' -> foobar>, <Rule '/wat' -> enter>])")
开发者ID:brunoais,项目名称:werkzeug,代码行数:8,代码来源:test_routing.py

示例2: test_authenticate_mixin

def test_authenticate_mixin():
    resp = wrappers.Response()
    resp.www_authenticate.type = 'basic'
    resp.www_authenticate.realm = 'Testing'
    strict_eq(resp.headers['WWW-Authenticate'], u'Basic realm="Testing"')
    resp.www_authenticate.realm = None
    resp.www_authenticate.type = None
    assert 'WWW-Authenticate' not in resp.headers
开发者ID:jasco,项目名称:werkzeug,代码行数:8,代码来源:test_wrappers.py

示例3: test_delete_requests_with_form

def test_delete_requests_with_form():
    @Request.application
    def test_app(request):
        return Response(request.form.get('x', None))

    client = Client(test_app, Response)
    resp = client.delete('/', data={'x': 42})
    strict_eq(resp.data, b'42')
开发者ID:ArielAzia,项目名称:werkzeug,代码行数:8,代码来源:test_test.py

示例4: test_stream_only_mixing

def test_stream_only_mixing():
    request = wrappers.PlainRequest.from_values(
        data=b'foo=blub+hehe',
        content_type='application/x-www-form-urlencoded'
    )
    assert list(request.files.items()) == []
    assert list(request.form.items()) == []
    pytest.raises(AttributeError, lambda: request.data)
    strict_eq(request.stream.read(), b'foo=blub+hehe')
开发者ID:jasco,项目名称:werkzeug,代码行数:9,代码来源:test_wrappers.py

示例5: test_secure

 def test_secure(self):
     response = wrappers.BaseResponse()
     response.set_cookie('foo', value='bar', max_age=60, expires=0,
                         path='/blub', domain='example.org', secure=True)
     strict_eq(response.headers.to_wsgi_list(), [
         ('Content-Type', 'text/plain; charset=utf-8'),
         ('Set-Cookie', 'foo=bar; Domain=example.org; Expires=Thu, '
          '01-Jan-1970 00:00:00 GMT; Max-Age=60; Secure; Path=/blub')
     ])
开发者ID:jasco,项目名称:werkzeug,代码行数:9,代码来源:test_wrappers.py

示例6: test_access_route

def test_access_route():
    req = wrappers.Request.from_values(headers={"X-Forwarded-For": "192.168.1.2, 192.168.1.1"})
    req.environ["REMOTE_ADDR"] = "192.168.1.3"
    assert req.access_route == ["192.168.1.2", "192.168.1.1"]
    strict_eq(req.remote_addr, "192.168.1.3")

    req = wrappers.Request.from_values()
    req.environ["REMOTE_ADDR"] = "192.168.1.3"
    strict_eq(list(req.access_route), ["192.168.1.3"])
开发者ID:tsampi,项目名称:tsampi-0,代码行数:9,代码来源:test_wrappers.py

示例7: test_multi_value_submit

def test_multi_value_submit():
    c = Client(multi_value_post_app, response_wrapper=BaseResponse)
    data = {"field": ["val1", "val2"]}
    resp = c.post("/", data=data)
    strict_eq(resp.status_code, 200)
    c = Client(multi_value_post_app, response_wrapper=BaseResponse)
    data = MultiDict({"field": ["val1", "val2"]})
    resp = c.post("/", data=data)
    strict_eq(resp.status_code, 200)
开发者ID:ajones620,项目名称:werkzeug,代码行数:9,代码来源:test_test.py

示例8: test_path_info_script_name_unquoting

def test_path_info_script_name_unquoting():
    def test_app(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain')])
        return [environ['PATH_INFO'] + '\n' + environ['SCRIPT_NAME']]
    c = Client(test_app, response_wrapper=BaseResponse)
    resp = c.get('/foo%40bar')
    strict_eq(resp.data, b'/[email protected]\n')
    c = Client(test_app, response_wrapper=BaseResponse)
    resp = c.get('/foo%40bar', 'http://localhost/bar%40baz')
    strict_eq(resp.data, b'/[email protected]\n/[email protected]')
开发者ID:ArielAzia,项目名称:werkzeug,代码行数:10,代码来源:test_test.py

示例9: test_post_with_file_descriptor

def test_post_with_file_descriptor(tmpdir):
    c = Client(Response(), response_wrapper=Response)
    f = tmpdir.join('some-file.txt')
    f.write('foo')
    with open(f.strpath, mode='rt') as data:
        resp = c.post('/', data=data)
    strict_eq(resp.status_code, 200)
    with open(f.strpath, mode='rb') as data:
        resp = c.post('/', data=data)
    strict_eq(resp.status_code, 200)
开发者ID:brunoais,项目名称:werkzeug,代码行数:10,代码来源:test_test.py

示例10: test_url_joining

def test_url_joining():
    strict_eq(urls.url_join('/foo', '/bar'), '/bar')
    strict_eq(urls.url_join('http://example.com/foo', '/bar'),
                             'http://example.com/bar')
    strict_eq(urls.url_join('file:///tmp/', 'test.html'),
                             'file:///tmp/test.html')
    strict_eq(urls.url_join('file:///tmp/x', 'test.html'),
                             'file:///tmp/test.html')
    strict_eq(urls.url_join('file:///tmp/x', '../../../x.html'),
                             'file:///x.html')
开发者ID:char101,项目名称:werkzeug,代码行数:10,代码来源:test_urls.py

示例11: test_environ_nonascii_pathinfo

def test_environ_nonascii_pathinfo():
    environ = create_environ(u'/лошадь')
    m = r.Map([
        r.Rule(u'/', endpoint='index'),
        r.Rule(u'/лошадь', endpoint='horse')
    ])
    a = m.bind_to_environ(environ)
    strict_eq(a.match(u'/'), ('index', {}))
    strict_eq(a.match(u'/лошадь'), ('horse', {}))
    pytest.raises(r.NotFound, a.match, u'/барсук')
开发者ID:brunoais,项目名称:werkzeug,代码行数:10,代码来源:test_routing.py

示例12: test_ie7_unc_path

 def test_ie7_unc_path(self):
     client = Client(form_data_consumer, Response)
     data_file = join(dirname(__file__), 'multipart', 'ie7_full_path_request.txt')
     data = get_contents(data_file)
     boundary = '---------------------------7da36d1b4a0164'
     response = client.post('/?object=cb_file_upload_multiple', data=data, content_type=
                                'multipart/form-data; boundary="%s"' % boundary, content_length=len(data))
     lines = response.get_data().split(b'\n', 3)
     strict_eq(lines[0],
                       repr(u'Sellersburg Town Council Meeting 02-22-2010doc.doc').encode('ascii'))
开发者ID:ArielAzia,项目名称:werkzeug,代码行数:10,代码来源:test_formparser.py

示例13: test_empty_keys_are_ignored

 def test_empty_keys_are_ignored(self):
     strict_eq(
         dict(http.parse_cookie(
             'first=IamTheFirst ; a=1; a=2 ;second=andMeTwo; ; '
         )),
         {
             'first': u'IamTheFirst',
             'a': u'2',
             'second': u'andMeTwo'
         }
     )
开发者ID:brunoais,项目名称:werkzeug,代码行数:11,代码来源:test_http.py

示例14: test_full_url_requests_with_args

def test_full_url_requests_with_args():
    base = 'http://example.com/'

    @Request.application
    def test_app(request):
        return Response(request.args['x'])
    client = Client(test_app, Response)
    resp = client.get('/?x=42', base)
    strict_eq(resp.data, b'42')
    resp = client.get('http://www.example.com/?x=23', base)
    strict_eq(resp.data, b'23')
开发者ID:ArielAzia,项目名称:werkzeug,代码行数:11,代码来源:test_test.py

示例15: test_access_route

def test_access_route():
    req = wrappers.Request.from_values(headers={
        'X-Forwarded-For': '192.168.1.2, 192.168.1.1'
    })
    req.environ['REMOTE_ADDR'] = '192.168.1.3'
    assert req.access_route == ['192.168.1.2', '192.168.1.1']
    strict_eq(req.remote_addr, '192.168.1.3')

    req = wrappers.Request.from_values()
    req.environ['REMOTE_ADDR'] = '192.168.1.3'
    strict_eq(list(req.access_route), ['192.168.1.3'])
开发者ID:jasco,项目名称:werkzeug,代码行数:11,代码来源:test_wrappers.py


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