code: def test_evoked_proj():
      """Test SSP proj operations."""
      for proj in [True, False]:
          ave = read_evokeds(fname, condition=0, proj=proj)
          assert all(p["active"] == proj for p in ave.info["projs"])
  
          # test adding / deleting proj
          if proj:
              pytest.raises(
                  ValueError,
                  ave.add_proj,
                  [],
                  {"remove_existing": True},
              )
              pytest.raises(ValueError, ave.del_proj, 0)
          else:
              projs = deepcopy(ave.info["projs"])
              n_proj = len(ave.info["projs"])
              ave.del_proj(0)
              assert len(ave.info["projs"]) == n_proj - 1
              # Test that already existing projections are not added.
              ave.add_proj(projs, remove_existing=False)
              assert len(ave.info["projs"]) == n_proj
              ave.add_proj(projs[:-1], remove_existing=True)
              assert len(ave.info["projs"]) == n_proj - 1
  
      ave = read_evokeds(fname, condition=0, proj=False)
      data = ave.data.copy()
      ave.apply_proj()
      assert_allclose(np.dot(ave._projector, data), ave.data)
  
imports: import pickle
  from copy import deepcopy
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import fftpack
  from mne import Epochs, EpochsArray, combine_evoked, create_info, equalize_channels, pick_types, read_events, read_evokeds, write_evokeds
  from mne._fiff.constants import FIFF
  from mne.evoked import Evoked, EvokedArray, _get_peak
  from mne.io import read_raw_fif
  from mne.utils import grand_average
label_desc: Use image node_id 16 for calling a global function with example usage: test_evoked_proj() without return types