code: def test_unfitted_lof_single_score():
      lof_detector = LOF(k=10)
      x = np.array([[0, 10], [0.1, 0]])
      x_ref = np.random.randn(100, 2)
  
      # test infer_threshold raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          _ = lof_detector.infer_threshold(x_ref, 0.1)
      assert str(err.value) == "LOF has not been fit!"
  
      # test score raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          _ = lof_detector.score(x)
      assert str(err.value) == "LOF has not been fit!"
  
      # test predict raises exception when not fitted
      with pytest.raises(NotFittedError) as err:
          _ = lof_detector.predict(x)
      assert str(err.value) == "LOF has not been fit!"
  
file_path: alibi-detect/alibi_detect/od/tests/test__lof/test__lof.py
imports: import pytest
  import numpy
  import torch
  from alibi_detect.od._lof import LOF
  from alibi_detect.od.pytorch.ensemble import AverageAggregator, TopKAggregator, MaxAggregator, MinAggregator, ShiftAndScaleNormalizer, PValNormalizer
  from alibi_detect.exceptions import NotFittedError, ThresholdNotInferredError
  from sklearn.datasets import make_moons
label_desc: Use image node_id 2 for calling a global function with example usage: test_unfitted_lof_single_score() without return types