From b3500d4a3494642057c4fc52993bcfbc13b30192 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 17 Mar 2021 17:18:24 +0100 Subject: [PATCH] Add some Python code to test bindings --- instant-distance-py/test/test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 instant-distance-py/test/test.py diff --git a/instant-distance-py/test/test.py b/instant-distance-py/test/test.py new file mode 100644 index 0000000..f93908f --- /dev/null +++ b/instant-distance-py/test/test.py @@ -0,0 +1,14 @@ +import instant_distance, random + +def main(): + points = [[random.random() for _ in range(300)] for _ in range(1024)] + config = instant_distance.Config() + (hnsw, ids) = instant_distance.Hnsw.build(points, config) + p = [random.random() for _ in range(300)] + search = instant_distance.Search() + hnsw.search(p, search) + for pid in search: + print(pid) + +if __name__ == '__main__': + main()