Example #1
0
def test_parse_bytes_only_start():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=0-"), ("bytes", [(0, None)]))
Example #2
0
def test_parse_bytes_start_greater_than_end():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=99-0"), None)
Example #3
0
def test_parse_bytes_start_greater_than_last_end():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=0-99,0-199"), None)
Example #4
0
def test_parse_bytes_two_many_ranges():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=-100,-100"), None)
Example #5
0
def test_parse_bytes_negative_start():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=-0-99"), None)
Example #6
0
def test_parse_bytes_missing_equals_sign():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes 0-99"), None)
Example #7
0
def test_parse_bytes_missing_dash():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=0 99"), None)
Example #8
0
def test_parse_bytes_only_start():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=0-'), ('bytes', [(0, None)]))
Example #9
0
def test_parse_bytes_valid_input():
    range = Range(((0, 100),))
    assert_equal(range.parse_bytes("bytes=0-99"), ("bytes", [(0, 100)]))
Example #10
0
def test_parse_bytes_start_greater_than_end():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=99-0'), None)
Example #11
0
def test_parse_bytes_start_greater_than_last_end():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=0-99,0-199'), None)
Example #12
0
def test_parse_bytes_negative_start():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=-0-99'), None)
Example #13
0
def test_parse_bytes_two_many_ranges():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=-100,-100'), None)
Example #14
0
def test_parse_bytes_missing_dash():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=0 99'), None)
Example #15
0
def test_parse_bytes_missing_equals_sign():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes 0-99'), None)
Example #16
0
def test_parse_bytes_valid_input():
    range = Range(((0, 100), ))
    assert_equal(range.parse_bytes('bytes=0-99'), ('bytes', [(0, 100)]))