def test_roundtrip_add_invalid_times(nwbfile, invalid_epochs, roundtripper): expected = write_nwb.setup_table_for_invalid_times(invalid_epochs) nwbfile = write_nwb.add_invalid_times(nwbfile, invalid_epochs) api = roundtripper(nwbfile, EcephysNwbSessionApi) obtained = api.get_invalid_times() pd.testing.assert_frame_equal(expected, obtained, check_dtype=False)
def test_setup_table_for_invalid_times(): epoch = { "type": "EcephysSession", "id": 739448407, "label": "stimulus", "start_time": 1998.0, "end_time": 2005.0, } s = write_nwb.setup_table_for_invalid_times([epoch]).loc[0] assert s["start_time"] == epoch["start_time"] assert s["stop_time"] == epoch["end_time"] assert s["tags"] == [epoch["type"], str(epoch["id"]), epoch["label"]]
def test_no_invalid_times_table(): epochs = [] assert write_nwb.setup_table_for_invalid_times(epochs).empty is True