-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add validate function to documents to have less verbose api (#1058
) * feat: add validate on Text document Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * fix: complete test Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * feat: add image shortcut Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * feat: add video Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * docs: we to u Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * feat: add mesh Signed-off-by: samsja <sami.jaghouar@hotmail.fr> * feat: add audio Signed-off-by: samsja <sami.jaghouar@hotmail.fr> Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
- Loading branch information
Showing
12 changed files
with
291 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
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 @@ | ||
from pydantic import parse_obj_as | ||
|
||
from docarray import BaseDocument | ||
from docarray.documents import Text | ||
|
||
|
||
def test_simple_init(): | ||
t = Text(text='hello') | ||
assert t.text == 'hello' | ||
|
||
|
||
def test_str_init(): | ||
t = parse_obj_as(Text, 'hello') | ||
assert t.text == 'hello' | ||
|
||
|
||
def test_doc(): | ||
class MyDoc(BaseDocument): | ||
text1: Text | ||
text2: Text | ||
|
||
doc = MyDoc(text1='hello', text2=Text(text='world')) | ||
|
||
assert doc.text1.text == 'hello' | ||
assert doc.text2.text == 'world' |
Oops, something went wrong.