Skip to content

Commit

Permalink
Unit test for anndata wrapper + to_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
keller-mark committed Aug 7, 2024
1 parent bc7b353 commit 7bb6768
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 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 @@ -60,6 +61,52 @@ def test_config_add_dataset():
"initStrategy": "auto"
}

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()
print(vc_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")
Expand Down

0 comments on commit 7bb6768

Please sign in to comment.