Пример #1
0
def test_converter_date_docstring():
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    desc = converter_date(environ_getter(
        "HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    assert 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8' in desc.__doc__
    assert '``Date`` header' in desc.__doc__
Пример #2
0
def test_converter_date_docstring():
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    desc = converter_date(
        environ_getter("HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    assert 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8' in desc.__doc__
    assert '``Date`` header' in desc.__doc__
Пример #3
0
def test_converter_date():
    import datetime
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    req = Request.blank('/')
    UTC = GMT()
    desc = converter_date(environ_getter(
        "HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    assert desc.fget(req) == datetime.datetime(1994, 11, 15, 8, 12, 31, tzinfo=UTC)
Пример #4
0
def test_converter_date():
    import datetime
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    req = Request.blank('/')
    UTC = GMT()
    desc = converter_date(
        environ_getter("HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    eq_(desc.fget(req), datetime.datetime(1994, 11, 15, 8, 12, 31, tzinfo=UTC))
Пример #5
0
def test_converter_date_docstring():
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    desc = converter_date(environ_getter(
        "HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    eq_(desc.__doc__, "Gets and sets the 'HTTP_DATE' key in the environment. "
        "For more information on Date see `section 14.8 "
        "<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8>`_.  "
        "Converts it using HTTP date.")
Пример #6
0
def test_converter_date_docstring():
    from webob.descriptors import converter_date
    from webob.descriptors import environ_getter
    desc = converter_date(
        environ_getter("HTTP_DATE", "Tue, 15 Nov 1994 08:12:31 GMT", "14.8"))
    eq_(
        desc.__doc__, "Gets and sets the 'HTTP_DATE' key in the environment. "
        "For more information on Date see `section 14.8 "
        "<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8>`_.  "
        "Converts it using HTTP date.")