diff --git a/tests/test_index_binary.py b/tests/test_index_binary.py index 312530ad46..b505e0ba1c 100644 --- a/tests/test_index_binary.py +++ b/tests/test_index_binary.py @@ -143,6 +143,15 @@ def test_range_search(self): # nb tests is actually low... self.assertTrue(nt1 > 19 and nt2 > 19) + def test_reconstruct(self): + index = faiss.IndexBinaryFlat(64) + input_vector = np.random.randint(0, 255, size=(10, index.code_size)).astype("uint8") + index.add(input_vector) + + reconstructed_vector = index.reconstruct_n(0, 4) + assert reconstructed_vector.shape == (4, index.code_size) + assert np.all(input_vector[:4] == reconstructed_vector) + class TestBinaryIVF(unittest.TestCase):