Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
arie-matsliah committed Feb 14, 2024
1 parent 119e3c0 commit d556cc1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/unit/test_neuron_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,13 @@ def test_similar_connectivity(self):
)

def test_similar_embeddings(self):
def assertAlmostEqualDicts(dct1, dct2):
self.assertEqual(set(dct1.keys()), set(dct2.keys()))
for k1, v1 in dct1.items():
self.assertAlmostEquals(v1, dct2[k1])

cell_rid = 720575940639310150
self.assertEqual(
assertAlmostEqualDicts(
{
720575940611395448: 0.9998702775818392,
720575940613079781: 0.9987719963659514,
Expand All @@ -775,7 +780,7 @@ def test_similar_embeddings(self):
self.neuron_db.get_similar_embedding_cells(cell_rid, limit=5),
)

self.assertEqual(
assertAlmostEqualDicts(
{
720575940611395448: 0.9998466002854165,
720575940613079781: 0.9988949638022473,
Expand All @@ -788,7 +793,7 @@ def test_similar_embeddings(self):
),
)

self.assertEqual(
assertAlmostEqualDicts(
{
720575940611395448: 0.9953633340823633,
720575940613079781: 0.9983502242966248,
Expand Down

0 comments on commit d556cc1

Please sign in to comment.