Skip to content

Commit

Permalink
add tests for untested lines
Browse files Browse the repository at this point in the history
  • Loading branch information
thht committed Sep 25, 2024
1 parent 6ae6384 commit 0341739
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mne_bids/tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -4204,3 +4204,23 @@ def test_write_bids_with_age_weight_info(tmp_path):
write_raw_bids(raw, bids_path=bids_path)
bids_path = _bids_path.copy().update(root=bids_root, datatype="meg", run=2)
write_raw_bids(raw, bids_path=bids_path)

# Test that we get a value error when we have more than one item
raw.info["subject_info"] = {
"weight": np.array([75.0, 10.2]),
"height": np.array([180.0]),
}

with pytest.raises(ValueError):
bids_path = _bids_path.copy().update(root=bids_root, datatype="meg", run=3)
write_raw_bids(raw, bids_path=bids_path)

# Test that scalar data is handled correctly

raw.info["subject_info"] = {
"weight": 75.0,
"height": np.array([180.0]),
}

bids_path = _bids_path.copy().update(root=bids_root, datatype="meg", run=3)
write_raw_bids(raw, bids_path=bids_path)

0 comments on commit 0341739

Please sign in to comment.