Test Vicinity.save and Vicinity.load. :param tmp_path: Temporary directory provided by pytest. :param vicinity_instance: A Vicinity instance.
(tmp_path: Path, vicinity_instance_with_stored_vectors: Vicinity)
| 147 | |
| 148 | |
| 149 | def test_vicinity_save_and_load_vector_store(tmp_path: Path, vicinity_instance_with_stored_vectors: Vicinity) -> None: |
| 150 | """ |
| 151 | Test Vicinity.save and Vicinity.load. |
| 152 | |
| 153 | :param tmp_path: Temporary directory provided by pytest. |
| 154 | :param vicinity_instance: A Vicinity instance. |
| 155 | """ |
| 156 | save_path = tmp_path / "vicinity_data" |
| 157 | vicinity_instance_with_stored_vectors.save(save_path) |
| 158 | |
| 159 | assert (save_path / "store").exists() |
| 160 | assert (save_path / "store" / "vectors.npy").exists() |
| 161 | |
| 162 | v = Vicinity.load(save_path) |
| 163 | assert v.vector_store is not None |
| 164 | |
| 165 | |
| 166 | def test_vicinity_save_and_load_non_serializable_items( |