From d556cc16fe59b09d44c140b49d439aeb8cd1fd33 Mon Sep 17 00:00:00 2001 From: Arie Matsliah Date: Wed, 14 Feb 2024 08:45:50 -0500 Subject: [PATCH] Fix flaky test --- tests/unit/test_neuron_data.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_neuron_data.py b/tests/unit/test_neuron_data.py index de9e74ef..ea5272dd 100644 --- a/tests/unit/test_neuron_data.py +++ b/tests/unit/test_neuron_data.py @@ -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, @@ -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, @@ -788,7 +793,7 @@ def test_similar_embeddings(self): ), ) - self.assertEqual( + assertAlmostEqualDicts( { 720575940611395448: 0.9953633340823633, 720575940613079781: 0.9983502242966248,