# Path: httoop/exceptions.py
# class InvalidHeader(Invalid):
# 	u"""error raised when header is invalid"""


import io
import pytest
from httoop.exceptions import InvalidHeader
		headers.elements('Range')
	print(exc.value)


@pytest.mark.parametrize('byte_range,ranges,length', [
	(b'bytes 0-100/3032', (0, 100), 3032),
	(b'bytes 0-100/*', (0, 100), None),
	# (pytest.param(b'bytes */3032', marks=pytest.mark.xfail), (None, None), None)  # FIXME: b'bytes 0-3032/3032'
])
def test_content_range(headers, byte_range, ranges, length):
	headers['Content-Range'] = byte_range
	assert headers.get_element('Content-Range') == 'bytes'
	assert headers.get_element('Content-Range').range == ranges
	assert headers.get_element('Content-Range').length == length
	assert bytes(headers.get_element('Content-Range')) == byte_range


@pytest.mark.parametrize('byte_range', [
	'foo 0-100/3032',
	'bytes 0-100/-3032',
	'bytes -100/3032',
	'bytes 100-/3032',
	'bytes -0-100/3032',
	'bytes 4-2/3032',
	'bytes */*',
	'bytes *-*/*',
	'bytes -/*',
])
def test_invalid_content_range(headers, byte_range):
	headers['Content-Range'] = byte_range

# Path: httoop/exceptions.py
# class InvalidHeader(Invalid):
# 	u"""error raised when header is invalid"""


# Path: tests/headers/test_header_elements.py
import io
import pytest
from httoop.exceptions import InvalidHeader

		headers.elements('Range')
	print(exc.value)


@pytest.mark.parametrize('byte_range,ranges,length', [
	(b'bytes 0-100/3032', (0, 100), 3032),
	(b'bytes 0-100/*', (0, 100), None),
	# (pytest.param(b'bytes */3032', marks=pytest.mark.xfail), (None, None), None)  # FIXME: b'bytes 0-3032/3032'
])
def test_content_range(headers, byte_range, ranges, length):
	headers['Content-Range'] = byte_range
	assert headers.get_element('Content-Range') == 'bytes'
	assert headers.get_element('Content-Range').range == ranges
	assert headers.get_element('Content-Range').length == length
	assert bytes(headers.get_element('Content-Range')) == byte_range


@pytest.mark.parametrize('byte_range', [
	'foo 0-100/3032',
	'bytes 0-100/-3032',
	'bytes -100/3032',
	'bytes 100-/3032',
	'bytes -0-100/3032',
	'bytes 4-2/3032',
	'bytes */*',
	'bytes *-*/*',
	'bytes -/*',
])
def test_invalid_content_range(headers, byte_range):
	headers['Content-Range'] = byte_range

	with pytest.raises(InvalidHeader) as exc: