Skip to content

Commit

Permalink
dont cover lazy fast-depends inject and "if len(applied) > 1"
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanUC committed Sep 3, 2024
1 parent e1bd7c6 commit 6f117b6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions yepcord/rest_api/y_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

from functools import wraps
from typing import Any, Callable, Optional
from typing import Any, Callable, Optional, Awaitable

from fast_depends import inject
from flask.sansio.scaffold import T_route, setupmethod
Expand All @@ -40,7 +40,7 @@ def apply_validator(src_func: T_route, type_: str, cls: Optional[type], source=N

applied.add(f"validate_{type_}")
setattr(func, "_patches", applied)
if len(applied) > 1:
if len(applied) > 1: # pragma: no cover
delattr(src_func, "_patches")

return func
Expand All @@ -52,7 +52,7 @@ def apply_inject(src_func: T_route) -> T_route:
if "fastdepends_inject" in applied:
return src_func

if Config.LAZY_INJECT:
if Config.LAZY_INJECT: # pragma: no cover
injected_func = None

@wraps(src_func)
Expand All @@ -68,7 +68,7 @@ async def func(*args, **kwargs):

applied.add("fastdepends_inject")
setattr(func, "_patches", applied)
if len(applied) > 1:
if len(applied) > 1: # pragma: no cover
delattr(src_func, "_patches")

return func
Expand All @@ -86,7 +86,7 @@ async def wrapped(*args, **kwargs):

applied.add("allow_bots")
setattr(wrapped, "_patches", applied)
if len(applied) > 1:
if len(applied) > 1: # pragma: no cover
delattr(src_func, "_patches")

return wrapped
Expand All @@ -105,7 +105,7 @@ async def wrapped(*args, **kwargs):

applied.add("oauth")
setattr(wrapped, "_patches", applied)
if len(applied) > 1:
if len(applied) > 1: # pragma: no cover
delattr(src_func, "_patches")

return wrapped
Expand Down

0 comments on commit 6f117b6

Please sign in to comment.