Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
karpetrosyan committed Jul 22, 2023
1 parent 1ccde2e commit 48e2920
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions hishel/_async/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def _init_transport(self, *args, **kwargs)-> AsyncCacheTransport: # type: ignor


def _init_proxy_transport(self, *args, **kwargs) -> AsyncCacheTransport: # type: ignore
_transport = super()._init_proxy_transport(*args, **kwargs)
return AsyncCacheTransport(
_transport = super()._init_proxy_transport(*args, **kwargs) # pragma: no cover
return AsyncCacheTransport( # pragma: no cover
transport=_transport,
storage=self._storage,
cache_controller=self._controller
Expand Down
6 changes: 3 additions & 3 deletions hishel/_async/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self,
cache_controller: tp.Optional[Controller] = None) -> None:
self._pool = pool

if storage is not None:
if storage is not None: # pragma: no cover
self._storage = storage
else: # pragma: no cover
else:
self._storage = AsyncFileStorage(serializer=DictSerializer())

if cache_controller is not None: # pragma: no cover
Expand Down Expand Up @@ -69,7 +69,7 @@ async def handle_async_request(self, request: Request) -> Response:

if self._controller.is_cachable(request=request, response=response):
await self._storage.store(key, response)
else:
else: # pragma: no cover
logger.debug(f"The response to the `{url}` url is not cacheable.")

return response
4 changes: 2 additions & 2 deletions hishel/_sync/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def _init_transport(self, *args, **kwargs)-> CacheTransport: # type: ignore


def _init_proxy_transport(self, *args, **kwargs) -> CacheTransport: # type: ignore
_transport = super()._init_proxy_transport(*args, **kwargs)
return CacheTransport(
_transport = super()._init_proxy_transport(*args, **kwargs) # pragma: no cover
return CacheTransport( # pragma: no cover
transport=_transport,
storage=self._storage,
cache_controller=self._controller
Expand Down
6 changes: 3 additions & 3 deletions hishel/_sync/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self,
cache_controller: tp.Optional[Controller] = None) -> None:
self._pool = pool

if storage is not None:
if storage is not None: # pragma: no cover
self._storage = storage
else: # pragma: no cover
else:
self._storage = FileStorage(serializer=DictSerializer())

if cache_controller is not None: # pragma: no cover
Expand Down Expand Up @@ -69,7 +69,7 @@ def handle_request(self, request: Request) -> Response:

if self._controller.is_cachable(request=request, response=response):
self._storage.store(key, response)
else:
else: # pragma: no cover
logger.debug(f"The response to the `{url}` url is not cacheable.")

return response
4 changes: 2 additions & 2 deletions hishel/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

def normalized_url(url: tp.Union[httpcore.URL, str, bytes]) -> str:

if isinstance(url, str):
if isinstance(url, str): # pragma: no cover
return url

if isinstance(url, bytes):
if isinstance(url, bytes): # pragma: no cover
return url.decode('ascii')

if isinstance(url, httpcore.URL):
Expand Down

0 comments on commit 48e2920

Please sign in to comment.