-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
115 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""FastDepends - extracted and cleared from HTTP domain FastAPI Dependency Injection System""" | ||
|
||
__version__ = "2.2.3" | ||
__version__ = "2.2.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
|
||
from fast_depends import Depends, inject | ||
|
||
|
||
def _get_var(): | ||
return 1 | ||
|
||
|
||
class Class: | ||
@inject | ||
def __init__(self, a = Depends(_get_var)) -> None: | ||
self.a = a | ||
|
||
@inject | ||
async def calc(self, a = Depends(_get_var)) -> int: | ||
return a + self.a | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_class(): | ||
assert await Class().calc() == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from fast_depends import Depends, inject | ||
|
||
|
||
def _get_var(): | ||
return 1 | ||
|
||
|
||
class Class: | ||
@inject | ||
def __init__(self, a = Depends(_get_var)) -> None: | ||
self.a = a | ||
|
||
@inject | ||
def calc(self, a = Depends(_get_var)) -> int: | ||
return a + self.a | ||
|
||
|
||
def test_class(): | ||
assert Class().calc() == 2 |