Skip to content

Commit 19a1c29

Browse files
committed
Update test_association_task.py array unit tests
Update unit tests in test_association_task.py to use np.testing.assert_array_equal for testing array equality.
1 parent fa71bc4 commit 19a1c29

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

tests/test_association_task.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,8 @@ def test_run(self):
6868
self.assertEqual(len(results.matchedDiaSources),
6969
len(self.diaObjects) - 1)
7070
self.assertEqual(len(results.unAssocDiaSources), 1)
71-
for test_obj_id, expected_obj_id in zip(
72-
results.matchedDiaSources["diaObjectId"].to_numpy(),
73-
[1, 2, 3, 4]):
74-
self.assertEqual(test_obj_id, expected_obj_id)
75-
for test_obj_id, expected_obj_id in zip(
76-
results.unAssocDiaSources["diaObjectId"].to_numpy(),
77-
[0]):
78-
self.assertEqual(test_obj_id, expected_obj_id)
71+
np.testing.assert_array_equal(results.matchedDiaSources["diaObjectId"].values, [1, 2, 3, 4])
72+
np.testing.assert_array_equal(results.unAssocDiaSources["diaObjectId"].values, [0])
7973

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

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

0 commit comments

Comments
 (0)