Skip to content

Commit

Permalink
Corrected get_keys() thanks to @amorgun . Imported itertools
Browse files Browse the repository at this point in the history
  • Loading branch information
erramuzpe committed Aug 2, 2016
1 parent a633789 commit 0a7df4f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nearpy/tests/engine_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import numpy
import scipy
import unittest
import itertools


from nearpy import Engine
from nearpy.utils.utils import unitvec
Expand Down Expand Up @@ -75,9 +77,12 @@ def test_retrieval_sparse(self):
self.assertAlmostEqual(y_distance, 0.0, delta=delta)

def get_keys(self, engine):
for lshash in engine.lshashes:
bucket = engine.storage.buckets[lshash.hash_name][lshash.hash_name]
return {i[1] for i in bucket}
def get_bucket_keys(lshash):
for v, i in engine.storage.buckets[lshash.hash_name][lshash.hash_name]:
yield i

return set(itertools.chain.from_iterable(
get_bucket_keys(lshash) for lshash in engine.lshashes))

def test_delete_vector_single_hash(self):
dim = 5
Expand Down

0 comments on commit 0a7df4f

Please sign in to comment.