Example #1
0
def test_serialize_content_range_defined():
    from webob.descriptors import serialize_content_range

    assert serialize_content_range((0, 500, 1234)) == "bytes 0-499/1234"
Example #2
0
def test_serialize_content_range_invalid():
    from webob.descriptors import serialize_content_range

    with pytest.raises(ValueError):
        serialize_content_range((1, ))
Example #3
0
def test_serialize_content_range_asterisk():
    from webob.descriptors import serialize_content_range

    assert serialize_content_range((0, 500)) == "bytes 0-499/*"
Example #4
0
def test_serialize_content_range_none():
    from webob.descriptors import serialize_content_range

    assert serialize_content_range(None) == "None"  # XXX: Seems wrong
Example #5
0
def test_serialize_content_range_emptystr():
    from webob.descriptors import serialize_content_range

    assert serialize_content_range("") is None
Example #6
0
def test_serialize_content_range_asterisk():
    from webob.descriptors import serialize_content_range
    assert serialize_content_range((0, 500)) == 'bytes 0-499/*'
Example #7
0
def test_serialize_content_range_defined():
    from webob.descriptors import serialize_content_range
    assert serialize_content_range((0, 500, 1234)) == 'bytes 0-499/1234'
Example #8
0
def test_serialize_content_range_emptystr():
    from webob.descriptors import serialize_content_range
    assert serialize_content_range('') == None
Example #9
0
def test_serialize_content_range_invalid():
    from webob.descriptors import serialize_content_range
    with pytest.raises(ValueError):
        serialize_content_range((1,))
Example #10
0
def test_serialize_content_range_asterisk():
    from webob.descriptors import serialize_content_range
    eq_(serialize_content_range((0, 500)), 'bytes 0-499/*')
Example #11
0
def test_serialize_content_range_none():
    from webob.descriptors import serialize_content_range
    assert serialize_content_range(None) == 'None' ### XXX: Seems wrong
Example #12
0
def test_serialize_content_range_emptystr():
    from webob.descriptors import serialize_content_range
    eq_(serialize_content_range(''), None)
Example #13
0
def test_serialize_content_range_none():
    from webob.descriptors import serialize_content_range
    eq_(serialize_content_range(None), 'None')  ### XXX: Seems wrong
Example #14
0
def test_serialize_content_range_none():
    from webob.descriptors import serialize_content_range
    eq_(serialize_content_range(None), 'None') ### XXX: Seems wrong
Example #15
0
def test_serialize_content_range_asterisk():
    from webob.descriptors import serialize_content_range

    eq_(serialize_content_range((0, 500)), "bytes 0-499/*")
Example #16
0
def test_serialize_content_range_emptystr():
    from webob.descriptors import serialize_content_range

    eq_(serialize_content_range(""), None)