-
Notifications
You must be signed in to change notification settings - Fork 2
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
16 changed files
with
369 additions
and
151 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
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,25 @@ | ||
import pytest | ||
from aligned import feature_view, Int32, CustomMethodDataSource | ||
from aligned.request.retrival_request import RetrivalRequest | ||
import polars as pl | ||
|
||
|
||
async def all_data(request: RetrivalRequest, limit: int | None = None) -> pl.LazyFrame: | ||
|
||
return pl.DataFrame({'some_id': [1, 2, 3], 'feature': [2, 3, 4]}).lazy() | ||
|
||
|
||
@feature_view(name='right', source=CustomMethodDataSource.from_methods(all_data=all_data)) | ||
class CustomSourceData: | ||
|
||
some_id = Int32().as_entity() | ||
|
||
feature = Int32() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_custom_source() -> None: | ||
|
||
result = await CustomSourceData.query().all().to_polars() | ||
|
||
assert result.equals(pl.DataFrame({'some_id': [1, 2, 3], 'feature': [2, 3, 4]}).select(result.columns)) |
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
Oops, something went wrong.