Skip to content

Commit

Permalink
update test file
Browse files Browse the repository at this point in the history
  • Loading branch information
nilchia committed Aug 7, 2024
1 parent 6906470 commit bbfac35
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/unit/data/datatypes/test_h5ad_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@


def test_h5ad_sniff():
ann = Anndata()
with get_input_files("anndata.h5ad") as input_files:
assert Anndata.sniff(input_files[0]) is True
assert ann.sniff(input_files[0]) is True


def test_h5ad_set_meta():
ann = Anndata()
with get_input_files("anndata.h5ad") as input_files:
dataset = MockDataset(1)
dataset.set_file_name(input_files[0])

Anndata.set_meta(dataset)
ann.set_meta(dataset)

assert dataset.metadata.layers_count == "9"
assert dataset.metadata.layers_names == "['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp']"

assert Anndata.set_meta._layercountsize(dataset) == "['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp'], 9, 0"
assert ann.set_meta._layercountsize(dataset) == "['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp'], 9, 0"



def test_h5ad_set_peek():
ann = Anndata()
with get_input_files("anndata.h5ad") as input_files:
dataset = MockDataset(1)
dataset.set_file_name(input_files[0])
assert Anndata.display_peek(dataset) == "Peek unavailable"
assert ann.display_peek(dataset) == "Peek unavailable"

Anndata.set_meta(dataset)
Anndata.set_peek(dataset)
ann.set_meta(dataset)
ann.set_peek(dataset)

assert (
dataset.peek
Expand All @@ -47,9 +50,7 @@ def test_h5ad_set_peek():
[var]: 1 layer
index
[obsm]: 0 layer
[varm]: 0 layer
[uns]: 0 layer
"""
)

0 comments on commit bbfac35

Please sign in to comment.