forked from run-llama/llama_index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make OneDriverReader serializable (run-llama#12342)
- Loading branch information
Showing
4 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...-index-integrations/readers/llama-index-readers-microsoft-onedrive/CHANGELOG.md
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,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## [0.1.4] - 2024-03-26 | ||
|
||
- Make OneDriveReader serializable | ||
|
||
## [0.1.2] - 2024-02-13 | ||
|
||
- Add maintainers and keywords from library.json (llamahub) |
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
21 changes: 21 additions & 0 deletions
21
...s/readers/llama-index-readers-microsoft-onedrive/tests/test_readers_microsoft_onedrive.py
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,7 +1,28 @@ | ||
from llama_index.core.readers.base import BaseReader | ||
from llama_index.readers.microsoft_onedrive import OneDriveReader | ||
|
||
test_client_id = "test_client_id" | ||
test_tenant_id = "test_tenant_id" | ||
|
||
|
||
def test_class(): | ||
names_of_base_classes = [b.__name__ for b in OneDriveReader.__mro__] | ||
assert BaseReader.__name__ in names_of_base_classes | ||
|
||
|
||
def test_serialize(): | ||
reader = OneDriveReader( | ||
client_id=test_client_id, | ||
tenant_id=test_tenant_id, | ||
) | ||
|
||
schema = reader.schema() | ||
assert schema is not None | ||
assert len(schema) > 0 | ||
assert "client_id" in schema["properties"] | ||
|
||
json = reader.json(exclude_unset=True) | ||
|
||
new_reader = OneDriveReader.parse_raw(json) | ||
assert new_reader.client_id == reader.client_id | ||
assert new_reader.tenant_id == reader.tenant_id |