-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add FunctionCollection as a type * wip * 'Refactored by Sourcery' (#157) Co-authored-by: Sourcery AI <> * wip * wip * tested definitions for function collections * changelog update * removed the magic. I didn't like it * fix some merge mess up in the changelog Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9d10522
commit 4d577db
Showing
6 changed files
with
84 additions
and
7 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
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
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,21 @@ | ||
from typing import Callable | ||
|
||
from lagom import Container, FunctionCollection | ||
|
||
|
||
def _func_a(input: str) -> str: | ||
return f"func_a({input})" | ||
|
||
|
||
def _func_b(input: str) -> str: | ||
return f"func_b({input})" | ||
|
||
|
||
SomeSignature = Callable[[str], str] | ||
|
||
|
||
def test_a_function_collection_can_be_used_by_a_container( | ||
container: Container, | ||
): | ||
container[FunctionCollection[SomeSignature]] = FunctionCollection(_func_a, _func_b) | ||
assert container[FunctionCollection[SomeSignature]] == [_func_a, _func_b] |
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