from urllib.parse import parse_qsl, urlencode
import chardet
-import idna
import rfc3986
-from .config import SSLConfig, TimeoutConfig
from .decoders import (
ACCEPT_ENCODING,
SUPPORTED_DECODERS,
while True:
try:
yield self._loop.run_until_complete(inner.__anext__())
- except StopAsyncIteration as exc:
+ except StopAsyncIteration:
break
def raw(self) -> typing.Iterator[bytes]:
while True:
try:
yield self._loop.run_until_complete(inner.__anext__())
- except StopAsyncIteration as exc:
+ except StopAsyncIteration:
break
def close(self) -> None:
def test_url():
- request = httpcore.Request("GET", "http://example.org")
+ url = "http://example.org"
+ request = httpcore.Request("GET", url)
assert request.url.scheme == "http"
assert request.url.port == 80
assert request.url.full_path == "/"
- request = httpcore.Request("GET", "https://example.org/abc?foo=bar")
+ url = "https://example.org/abc?foo=bar"
+ request = httpcore.Request("GET", url)
assert request.url.scheme == "https"
assert request.url.port == 443
assert request.url.full_path == "/abc?foo=bar"
"https://example.org:123/path/to/somewhere?b=456", query_params={"a": "123"}
)
assert str(url) == "https://example.org:123/path/to/somewhere?a=123"
+
+
+def test_url_set():
+ urls = (
+ URL("http://example.org:123/path/to/somewhere"),
+ URL("http://example.org:123/path/to/somewhere/else"),
+ )
+
+ url_set = set(urls)
+
+ assert all(url in urls for url in url_set)