Skip to content

Commit 044c23c

Browse files
committed
add(test): tests for consistent None return for by_name method
1 parent 4cb5a58 commit 044c23c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

pipeline/tests/test_regressions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,17 @@ def test_issue0069(om):
331331
results = om.core.License.by_name("Creative Commons", all=True, match="contains")
332332
assert len(results) == 7
333333
assert all("CC" in r.short_name for r in results)
334+
335+
@pytest.mark.parametrize("om", [openminds.latest])
336+
def test_pr0083(om):
337+
# https://github.com/openMetadataInitiative/openMINDS_Python/pull/83
338+
# by_name() should return None consistently
339+
# when no matches are found, regardless of the 'all' parameter
340+
341+
# all=False (default) should return None when no match is found
342+
result = om.controlled_terms.BiologicalOrder.by_name("nonexistent_order_xyz")
343+
assert result is None
344+
345+
# all=True should also return None when no match is found
346+
results = om.controlled_terms.BiologicalOrder.by_name("nonexistent_order_xyz", all=True)
347+
assert results is None

0 commit comments

Comments
 (0)