From f7d8a0c1ce3b3119b807b775ad56a84fef132c3c Mon Sep 17 00:00:00 2001 From: Keya Loding Date: Tue, 16 Jul 2024 09:45:22 -0700 Subject: [PATCH] test --- tests/io/test_nwb.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/io/test_nwb.py b/tests/io/test_nwb.py index 1d2034d8..8f6d7c1b 100644 --- a/tests/io/test_nwb.py +++ b/tests/io/test_nwb.py @@ -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 @@ -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)