1
# Copyright (c) 2013 Spotify AB
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
# use this file except in compliance with the License. You may obtain a copy of
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations under
19
from annoy import AnnoyIndex
22
@pytest.fixture(scope="module", autouse=True)
24
if os.path.exists("on_disk.ann"):
25
os.remove("on_disk.ann")
35
assert i.get_nns_by_vector([4, 4], 3) == [2, 1, 0]
36
assert i.get_nns_by_vector([1, 1], 3) == [0, 1, 2]
37
assert i.get_nns_by_vector([4, 2], 3) == [1, 2, 0]
42
i = AnnoyIndex(f, "euclidean")
43
i.on_disk_build("on_disk.ann")
50
j = AnnoyIndex(f, "euclidean")