Skip to content

Commit faeba5e

Browse files
committed
test: add test that covers fix
1 parent c412c6f commit faeba5e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/unit/array/mixins/test_del.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from docarray import DocumentArray, Document
44
from docarray.array.weaviate import DocumentArrayWeaviate
5+
import numpy as np
56

67

78
@pytest.fixture()
@@ -81,3 +82,26 @@ def test_del_da_persist(da_cls, config, persist, docs, start_storage):
8182
assert len(da2) == len(docs)
8283
else:
8384
assert len(da2) == 0
85+
86+
87+
def test_del_da_attribute():
88+
89+
da = DocumentArray(
90+
[
91+
Document(embedding=np.array([1, 2, 3]), text='d1'),
92+
Document(embedding=np.array([1, 2, 3]), text='d2'),
93+
]
94+
)
95+
96+
q = DocumentArray(
97+
[
98+
Document(embedding=np.array([4, 5, 6]), text='q1'),
99+
Document(embedding=np.array([2, 3, 4]), text='q1'),
100+
]
101+
)
102+
103+
da.match(q)
104+
del da[...][:, 'embedding']
105+
106+
for d in da:
107+
assert d.embedding is None

0 commit comments

Comments
 (0)