Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
keyaloding committed Jul 16, 2024
1 parent 6c062ec commit f7d8a0c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/io/test_nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
from pynwb import NWBFile, NWBHDF5IO

from sleap_io import load_slp
from sleap_io.io.nwb import write_nwb, append_nwb_data, get_timestamps
from sleap_io.io.nwb import (
write_nwb,
append_nwb_data,
get_timestamps,
pose_training_to_labels,
labels_to_pose_training,
)


@pytest.fixture
Expand All @@ -24,6 +30,19 @@ def nwbfile():
return nwbfile


def test_nwb_slp_conversion():
labels_original = load_slp("tests/data/slp/minimal_instance.pkg.slp")
pose = labels_to_pose_training(labels_original)
labels_converted = pose_training_to_labels(pose)
assert len(labels_original.labeled_frames) == len(labels_converted.labeled_frames)
assert labels_original.provenance == labels_converted.provenance

original_instances_len = len(labels_original.labeled_frames[0].instances)
converted_instances_len = len(labels_converted.labeled_frames[0].instances)
assert original_instances_len == converted_instances_len



def test_typical_case_append(nwbfile, slp_typical):
labels = load_slp(slp_typical)
nwbfile = append_nwb_data(labels, nwbfile)
Expand Down

0 comments on commit f7d8a0c

Please sign in to comment.