Skip to content

Commit

Permalink
Unit test for to_dict output following .add_object(AnnDataWrapper(...…
Browse files Browse the repository at this point in the history
…)) (#357)

* Unit test for anndata wrapper + to_dict

* linting
  • Loading branch information
keller-mark authored Aug 31, 2024
1 parent bc7b353 commit 55b3f57
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
AbstractWrapper,
make_repr,
CoordinationLevel as CL,
AnnDataWrapper,

# Neither of these is in the source code, but they do appear in code which is eval'd.
VitessceChainableConfig,
Expand Down Expand Up @@ -61,6 +62,51 @@ def test_config_add_dataset():
}


def test_config_add_anndata_url():
vc = VitessceConfig(schema_version="1.0.15")
vc.add_dataset(name='My Dataset').add_object(
AnnDataWrapper(
adata_url="http://example.com/adata.h5ad.zarr",
obs_set_paths=["obs/louvain"],
)
)

vc_dict = vc.to_dict()

assert vc_dict == {
"version": "1.0.15",
"name": "",
"description": "",
"datasets": [
{
'uid': 'A',
'name': 'My Dataset',
'files': [
{
"fileType": "anndata.zarr",
"url": "http://example.com/adata.h5ad.zarr",
"options": {
"obsSets": [
{
"name": "louvain",
"path": "obs/louvain",
}
]
}
}
]
}
],
'coordinationSpace': {
'dataset': {
'A': 'A'
},
},
"layout": [],
"initStrategy": "auto"
}


def test_config_add_dataset_add_files():
vc = VitessceConfig(schema_version="1.0.15")
vc.add_dataset(name='My Chained Dataset').add_file(
Expand Down

0 comments on commit 55b3f57

Please sign in to comment.