Skip to content

Commit

Permalink
Added assertGreater + typos
Browse files Browse the repository at this point in the history
  • Loading branch information
erramuzpe committed Aug 2, 2016
1 parent ea983aa commit a633789
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions nearpy/tests/engine_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ def get_keys(self, engine):

def test_delete_vector_single_hash(self):
dim = 5
name_hash = 'testHash'
unibucket = UniBucket(name_hash)
engine = Engine(dim, lshashes=[unibucket])
engine = Engine(dim, lshashes=[UniBucket('testHash')])
# Index 20 random vectors (set their data to a unique string)
for index in range(20):
v = numpy.random.randn(dim)
Expand All @@ -95,16 +93,13 @@ def test_delete_vector_single_hash(self):

new_keys = self.get_keys(engine)

self.assertTrue(len(keys) > len(new_keys)) #new keys has 19 elements instead of 20
self.assertGreater(len(keys), len(new_keys)) #new keys has 19 elements instead of 20
self.assertIn(15, keys)
self.assertNotIn(15, new_keys) # the key 15 is the one missing

def test_delete_vector_multiple_hash(self):
dim = 5
hashes = []
for k in range(10): # 10 hashes
unibucket = UniBucket('name_hash_%d' % k)
hashes.append(unibucket)
hashes = [UniBucket('name_hash_%d' % k) for k in range(10)]
engine = Engine(dim, lshashes=hashes)
# Index 20 random vectors (set their data to a unique string)
for index in range(20):
Expand All @@ -117,7 +112,7 @@ def test_delete_vector_multiple_hash(self):

new_keys = self.get_keys(engine)

self.assertTrue(len(keys) > len(new_keys)) #new keys has 19 elements instead of 20
self.assertGreater(len(keys), len(new_keys)) #new keys has 19 elements instead of 20
self.assertIn(15, keys)
self.assertNotIn(15, new_keys) # the key 15 is the one missing

Expand Down

0 comments on commit a633789

Please sign in to comment.