-
Notifications
You must be signed in to change notification settings - Fork 936
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@data_layer API hook to configure data layer. (#1463)
* @data_layer API hook to configure data layer. * Use @data_layer in e2e test. * Unit tests for get_data_layer() and @data_layer. * Test cleanup should never fail.
- Loading branch information
Showing
11 changed files
with
169 additions
and
69 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,18 @@ | ||
from unittest.mock import AsyncMock, Mock | ||
|
||
from chainlit.data import get_data_layer | ||
|
||
|
||
async def test_get_data_layer( | ||
mock_data_layer: AsyncMock, | ||
mock_get_data_layer: Mock, | ||
): | ||
# Check whether the data layer is properly set | ||
assert mock_data_layer == get_data_layer() | ||
|
||
mock_get_data_layer.assert_called_once() | ||
|
||
# Getting the data layer again, should not result in additional call | ||
assert mock_data_layer == get_data_layer() | ||
|
||
mock_get_data_layer.assert_called_once() |
Oops, something went wrong.