Skip to content

Commit

Permalink
🧪 Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun committed Oct 11, 2024
1 parent 9c94aae commit 043ce8f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/core/test_queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ def test_df():
df = ln.ULabel.filter(name="Project 0").df(include="created_by__name")
assert df["created_by__name"].iloc[0] == "Test User1"

# do not return fields with no data in the registry
df = (
ln.Artifact.using("laminlabs/cellxgene")
.filter(suffix=".h5ad")
.df(include=["tissues__name", "pathways__name"])
)
assert "tissues__name" in df.columns
assert "pathways__name" not in df.columns

# clean up
project_label.delete()
for label in labels:
Expand All @@ -91,9 +100,10 @@ def test_one_first():
with pytest.raises(DoesNotExist):
qs.one()
qs = bt.Source.filter().all()
with pytest.raises(Exception): # noqa: B017 should be MultipleResultsFound, but internal to Django
# should be MultipleResultsFound, but internal to Django
with pytest.raises(Exception): # noqa: B017
qs.one()
with pytest.raises(Exception): # noqa: B017 should be MultipleResultsFound, but internal to Django
with pytest.raises(Exception): # noqa: B017
qs.one_or_none()


Expand Down

0 comments on commit 043ce8f

Please sign in to comment.