Skip to content

Commit a4fdb77

Browse files
author
Joan Fontanals
authored
text: fix failing test (docarray#1793)
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
1 parent 4ef4939 commit a4fdb77

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docarray/documents/video.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@ class VideoDoc(BaseDoc):
3939
You can use this Document directly:
4040
4141
```python
42-
from docarray.documents import VideoDoc
42+
from docarray.documents import VideoDoc, AudioDoc
4343
4444
# use it directly
4545
vid = VideoDoc(
4646
url='https://github.com/docarray/docarray/blob/main/tests/toydata/mov_bbb.mp4?raw=true'
4747
)
48-
vid.tensor, vid.audio.tensor, vid.key_frame_indices = vid.url.load()
48+
tensor, audio_tensor, key_frame_indices = vid.url.load()
49+
vid.tensor = tensor
50+
vid.audio = AudioDoc(tensor=audio_tensor)
51+
vid.key_frame_indices = key_frame_indices
4952
# model = MyEmbeddingModel()
5053
# vid.embedding = model(vid.tensor)
5154
```

tests/integrations/predefined_document/test_video.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pydantic import parse_obj_as
55

66
from docarray import BaseDoc
7-
from docarray.documents import VideoDoc
7+
from docarray.documents import VideoDoc, AudioDoc
88
from docarray.typing import AudioNdArray, NdArray, VideoNdArray
99
from docarray.utils._internal.misc import is_tf_available
1010
from docarray.utils._internal.pydantic import is_pydantic_v2
@@ -25,7 +25,10 @@
2525
@pytest.mark.parametrize('file_url', [LOCAL_VIDEO_FILE, REMOTE_VIDEO_FILE])
2626
def test_video(file_url):
2727
vid = VideoDoc(url=file_url)
28-
vid.tensor, vid.audio.tensor, vid.key_frame_indices = vid.url.load()
28+
tensor, audio_tensor, key_frame_indices = vid.url.load()
29+
vid.tensor = tensor
30+
vid.audio = AudioDoc(tensor=audio_tensor)
31+
vid.key_frame_indices = key_frame_indices
2932

3033
assert isinstance(vid.tensor, VideoNdArray)
3134
assert isinstance(vid.audio.tensor, AudioNdArray)

0 commit comments

Comments
 (0)