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


import pytest
from httoop.exceptions import InvalidURI
	request_.uri = '/foo'
	assert request_.uri == '/foo'


def test_uri_set_bytes(request_):
	request_.uri = b'/foo'
	assert request_.uri == b'/foo'


def test_uri_set_dict(request_):
	uri = {
		'scheme': 'http',
		'username': 'username',
		'password': 'password',
		'host': 'host',
		'port': 8090,
		'path': '/path',
		'query_string': 'query=string',
		'fragment': 'fragment'}
	request_.uri = uri
	assert request_.uri.dict == uri
	assert request_.uri == uri
	assert bytes(request_.uri) == b'http://username:password@host:8090/path?query=string#fragment'


def test_set_invalid_uri_nonascii(request_):
	with pytest.raises(InvalidURI):
		request_.uri = u'/fooäbar'
	with pytest.raises(InvalidURI):
		request_.uri = u'/fooäbar'.encode('latin-1')

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


# Path: tests/api/test_uri.py
import pytest
from httoop.exceptions import InvalidURI

	request_.uri = '/foo'
	assert request_.uri == '/foo'


def test_uri_set_bytes(request_):
	request_.uri = b'/foo'
	assert request_.uri == b'/foo'


def test_uri_set_dict(request_):
	uri = {
		'scheme': 'http',
		'username': 'username',
		'password': 'password',
		'host': 'host',
		'port': 8090,
		'path': '/path',
		'query_string': 'query=string',
		'fragment': 'fragment'}
	request_.uri = uri
	assert request_.uri.dict == uri
	assert request_.uri == uri
	assert bytes(request_.uri) == b'http://username:password@host:8090/path?query=string#fragment'


def test_set_invalid_uri_nonascii(request_):
	with pytest.raises(InvalidURI):
		request_.uri = u'/fooäbar'
	with pytest.raises(InvalidURI):
		request_.uri = u'/fooäbar'.encode('latin-1')

	with pytest.raises(InvalidURI):