Skip to content

Commit

Permalink
Update test_association_task.py array unit tests
Browse files Browse the repository at this point in the history
Update unit tests in test_association_task.py to use np.testing.assert_array_equal for testing array equality.
  • Loading branch information
bsmartradio committed Sep 19, 2023
1 parent e0a704b commit 58a77e4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/test_association_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,8 @@ def test_run(self):
self.assertEqual(len(results.matchedDiaSources),
len(self.diaObjects) - 1)
self.assertEqual(len(results.unAssocDiaSources), 1)
for test_obj_id, expected_obj_id in zip(
results.matchedDiaSources["diaObjectId"].to_numpy(),
[1, 2, 3, 4]):
self.assertEqual(test_obj_id, expected_obj_id)
for test_obj_id, expected_obj_id in zip(
results.unAssocDiaSources["diaObjectId"].to_numpy(),
[0]):
self.assertEqual(test_obj_id, expected_obj_id)
np.testing.assert_array_equal(results.matchedDiaSources["diaObjectId"].values, [1, 2, 3, 4])
np.testing.assert_array_equal(results.unAssocDiaSources["diaObjectId"].values, [0])

def test_run_trailed_sources(self):
"""Test the full task by associating a set of diaSources to
Expand Down Expand Up @@ -119,6 +113,7 @@ def test_associate_sources(self):
assoc_result.diaSources["diaObjectId"].to_numpy(),
[0, 1, 2, 3, 4]):
self.assertEqual(test_obj_id, expected_obj_id)
np.testing.assert_array_equal(assoc_result.diaSources["diaObjectId"].values, [0, 1, 2, 3, 4])

def test_score_and_match(self):
"""Test association between a set of sources and an existing
Expand Down

0 comments on commit 58a77e4

Please sign in to comment.