@@ -211,7 +211,7 @@ def test_get_single(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path):
211
211
for d in ten_simple_docs :
212
212
id_ = d .id
213
213
assert index [id_ ].id == id_
214
- assert np .all (index [id_ ].tens == d .tens )
214
+ assert np .allclose (index [id_ ].tens == d .tens )
215
215
216
216
# flat
217
217
index = HnswDocumentIndex [FlatDoc ](work_dir = str (flat_path ))
@@ -221,8 +221,8 @@ def test_get_single(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path):
221
221
for d in ten_flat_docs :
222
222
id_ = d .id
223
223
assert index [id_ ].id == id_
224
- assert np .all (index [id_ ].tens_one == d .tens_one )
225
- assert np .all (index [id_ ].tens_two == d .tens_two )
224
+ assert np .allclose (index [id_ ].tens_one == d .tens_one )
225
+ assert np .allclose (index [id_ ].tens_two == d .tens_two )
226
226
227
227
# nested
228
228
index = HnswDocumentIndex [NestedDoc ](work_dir = str (nested_path ))
@@ -233,7 +233,7 @@ def test_get_single(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path):
233
233
id_ = d .id
234
234
assert index [id_ ].id == id_
235
235
assert index [id_ ].d .id == d .d .id
236
- assert np .all (index [id_ ].d .tens == d .d .tens )
236
+ assert np .allclose (index [id_ ].d .tens == d .d .tens )
237
237
238
238
239
239
def test_get_multiple (ten_simple_docs , ten_flat_docs , ten_nested_docs , tmp_path ):
@@ -252,7 +252,7 @@ def test_get_multiple(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path)
252
252
retrieved_docs = index [ids_to_get ]
253
253
for id_ , d_in , d_out in zip (ids_to_get , docs_to_get , retrieved_docs ):
254
254
assert d_out .id == id_
255
- assert np .all (d_out .tens == d_in .tens )
255
+ assert np .allclose (d_out .tens == d_in .tens )
256
256
257
257
# flat
258
258
index = HnswDocumentIndex [FlatDoc ](work_dir = str (flat_path ))
@@ -264,8 +264,8 @@ def test_get_multiple(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path)
264
264
retrieved_docs = index [ids_to_get ]
265
265
for id_ , d_in , d_out in zip (ids_to_get , docs_to_get , retrieved_docs ):
266
266
assert d_out .id == id_
267
- assert np .all (d_out .tens_one == d_in .tens_one )
268
- assert np .all (d_out .tens_two == d_in .tens_two )
267
+ assert np .allclose (d_out .tens_one == d_in .tens_one )
268
+ assert np .allclose (d_out .tens_two == d_in .tens_two )
269
269
270
270
# nested
271
271
index = HnswDocumentIndex [NestedDoc ](work_dir = str (nested_path ))
@@ -278,7 +278,7 @@ def test_get_multiple(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path)
278
278
for id_ , d_in , d_out in zip (ids_to_get , docs_to_get , retrieved_docs ):
279
279
assert d_out .id == id_
280
280
assert d_out .d .id == d_in .d .id
281
- assert np .all (d_out .d .tens == d_in .d .tens )
281
+ assert np .allclose (d_out .d .tens == d_in .d .tens )
282
282
283
283
284
284
def test_get_key_error (ten_simple_docs , ten_flat_docs , ten_nested_docs , tmp_path ):
@@ -303,7 +303,7 @@ def test_del_single(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path):
303
303
index [id_ ]
304
304
else :
305
305
assert index [id_ ].id == id_
306
- assert np .all (index [id_ ].tens == d .tens )
306
+ assert np .allclose (index [id_ ].tens == d .tens )
307
307
# delete again
308
308
del index [ten_simple_docs [3 ].id ]
309
309
assert index .num_docs () == 8
@@ -314,7 +314,7 @@ def test_del_single(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path):
314
314
index [id_ ]
315
315
else :
316
316
assert index [id_ ].id == id_
317
- assert np .all (index [id_ ].tens == d .tens )
317
+ assert np .allclose (index [id_ ].tens == d .tens )
318
318
319
319
320
320
def test_del_multiple (ten_simple_docs , ten_flat_docs , ten_nested_docs , tmp_path ):
@@ -333,7 +333,7 @@ def test_del_multiple(ten_simple_docs, ten_flat_docs, ten_nested_docs, tmp_path)
333
333
index [doc .id ]
334
334
else :
335
335
assert index [doc .id ].id == doc .id
336
- assert np .all (index [doc .id ].tens == doc .tens )
336
+ assert np .allclose (index [doc .id ].tens == doc .tens )
337
337
338
338
339
339
def test_del_key_error (ten_simple_docs , ten_flat_docs , ten_nested_docs , tmp_path ):
0 commit comments