code: def test_when_fit_and_evaluate_kernel_based_density_estimator_1d_then_behaves_as_expected():
      test_data = np.array([[0, 1], [0, 2], [1, 0], [2, 3]])
  
      density_estimator_model = KernelDensityEstimator1D()
      with pytest.raises(RuntimeError):
          density_estimator_model.density(test_data)
  
      with pytest.raises(RuntimeError):
          density_estimator_model.fit(test_data)
  
      test_data = np.array([[0], [2], [1], [3]])
      density_estimator_model.fit(test_data)
      results = density_estimator_model.density(test_data)
  
      assert len(results) == 4
  
imports: import numpy
  import pytest
  from dowhy.gcm.density_estimators import GaussianMixtureDensityEstimator, KernelDensityEstimator1D
label_desc: Use image node_id 2 for calling a global function with example usage: test_when_fit_and_evaluate_kernel_based_density_estimator_1d_then_behaves_as_expected() without return types