code: def test_allow_nan_durations():
      """Deal with "n/a" strings in BIDS events with nan durations."""
      raw = RawArray(
          data=np.empty([2, 10], dtype=np.float64),
          info=create_info(ch_names=2, sfreq=1.0),
          first_samp=0,
      )
      raw.set_meas_date(0)
  
      ons = [1, 2.0, 15.0, 17.0]
      dus = [np.nan, 1.0, 0.5, np.nan]
      descriptions = ["A"] * 4
      onsets = np.asarray(ons, dtype=float)
      durations = np.asarray(dus, dtype=float)
      annot = mne.Annotations(
          onset=onsets, duration=durations, description=descriptions
      )
      with pytest.warns(RuntimeWarning, match="Omitted 2 annotation"):
          raw.set_annotations(annot)
  
imports: import sys
  from collections import OrderedDict
  from datetime import datetime, timedelta, timezone
  from itertools import repeat
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from pytest import approx
  import mne
  from mne import Annotations, Epochs, annotations_from_events, count_annotations, create_info, events_from_annotations, read_annotations
  from mne.annotations import _handle_meas_date, _read_annotations_txt_parse_header, _sync_onset
  from mne.datasets import testing
  from mne.io import RawArray, concatenate_raws, read_raw_fif
  from mne.utils import _dt_to_stamp, _raw_annot, _record_warnings, _stamp_to_dt, assert_and_remove_boundary_annot, catch_logging, check_version
label_desc: Use image node_id 40 for calling a global function with example usage: test_allow_nan_durations() without return types