code: def test_ajdc_fit_error(rndstate):
      n_subjects, n_conditions, n_channels, n_times = 2, 3, 8, 512
      ajdc = AJDC(dim_red={"expl_var": 0.9})
      with pytest.raises(ValueError):  # unequal # of conditions
          ajdc.fit(
              [
                  rndstate.randn(n_conditions, n_channels, n_times),
                  rndstate.randn(n_conditions + 1, n_channels, n_times),
              ]
          )
      with pytest.raises(ValueError):  # unequal # of channels
          ajdc.fit(
              [
                  rndstate.randn(n_conditions, n_channels, n_times),
                  rndstate.randn(n_conditions, n_channels + 1, n_times),
              ]
          )
      X = rndstate.randn(n_subjects, n_conditions, n_channels, n_times)
      V = rndstate.randn(n_channels, n_channels - 1)
      ajdc = AJDC(dim_red={"warm_restart": V})
      with pytest.raises(ValueError):  # initial diag not square
          ajdc.fit(X)
  
imports: from conftest import get_metrics
  import pytest
  import numpy
  from numpy.testing import assert_array_equal
  from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC
label_desc: Use image node_id 14 for calling a global function with example usage: test_ajdc_fit_error(rndstate) without return types