mirror of https://github.com/tiangolo/fastapi.git
♻️ Tweak coverage for unreachable code
This commit is contained in:
parent
fea894696e
commit
2de3fb2426
|
|
@ -91,14 +91,14 @@ class Dependant:
|
||||||
@cached_property
|
@cached_property
|
||||||
def is_gen_callable(self) -> bool:
|
def is_gen_callable(self) -> bool:
|
||||||
if self.call is None:
|
if self.call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
if inspect.isgeneratorfunction(
|
if inspect.isgeneratorfunction(
|
||||||
_impartial(self.call)
|
_impartial(self.call)
|
||||||
) or inspect.isgeneratorfunction(_unwrapped_call(self.call)):
|
) or inspect.isgeneratorfunction(_unwrapped_call(self.call)):
|
||||||
return True
|
return True
|
||||||
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
||||||
if dunder_call is None:
|
if dunder_call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
return inspect.isgeneratorfunction(
|
return inspect.isgeneratorfunction(
|
||||||
_impartial(dunder_call)
|
_impartial(dunder_call)
|
||||||
) or inspect.isgeneratorfunction(_unwrapped_call(dunder_call))
|
) or inspect.isgeneratorfunction(_unwrapped_call(dunder_call))
|
||||||
|
|
@ -106,14 +106,14 @@ class Dependant:
|
||||||
@cached_property
|
@cached_property
|
||||||
def is_async_gen_callable(self) -> bool:
|
def is_async_gen_callable(self) -> bool:
|
||||||
if self.call is None:
|
if self.call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
if inspect.isasyncgenfunction(
|
if inspect.isasyncgenfunction(
|
||||||
_impartial(self.call)
|
_impartial(self.call)
|
||||||
) or inspect.isasyncgenfunction(_unwrapped_call(self.call)):
|
) or inspect.isasyncgenfunction(_unwrapped_call(self.call)):
|
||||||
return True
|
return True
|
||||||
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
||||||
if dunder_call is None:
|
if dunder_call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
return inspect.isasyncgenfunction(
|
return inspect.isasyncgenfunction(
|
||||||
_impartial(dunder_call)
|
_impartial(dunder_call)
|
||||||
) or inspect.isasyncgenfunction(_unwrapped_call(dunder_call))
|
) or inspect.isasyncgenfunction(_unwrapped_call(dunder_call))
|
||||||
|
|
@ -121,7 +121,7 @@ class Dependant:
|
||||||
@cached_property
|
@cached_property
|
||||||
def is_coroutine_callable(self) -> bool:
|
def is_coroutine_callable(self) -> bool:
|
||||||
if self.call is None:
|
if self.call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
if inspect.isroutine(_impartial(self.call)) and iscoroutinefunction(
|
if inspect.isroutine(_impartial(self.call)) and iscoroutinefunction(
|
||||||
_impartial(self.call)
|
_impartial(self.call)
|
||||||
):
|
):
|
||||||
|
|
@ -132,7 +132,7 @@ class Dependant:
|
||||||
return True
|
return True
|
||||||
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
|
||||||
if dunder_call is None:
|
if dunder_call is None:
|
||||||
return False
|
return False # pragma: no cover
|
||||||
if iscoroutinefunction(_impartial(dunder_call)) or iscoroutinefunction(
|
if iscoroutinefunction(_impartial(dunder_call)) or iscoroutinefunction(
|
||||||
_unwrapped_call(dunder_call)
|
_unwrapped_call(dunder_call)
|
||||||
):
|
):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue