code: def test_label_encoder_errors(setup):
      # Check that invalid arguments yield ValueError
      le = LabelEncoder()
      with pytest.raises(ValueError):
          le.transform([])
      with pytest.raises(ValueError):
          le.inverse_transform([])
  
      # Fail on unseen labels
      le = LabelEncoder()
      le.fit(mt.tensor([1, 2, 3, -1, 1]))
      msg = "contains previously unseen labels"
      with pytest.raises(ValueError, match=msg):
          le.inverse_transform(mt.tensor([-2]))
      with pytest.raises(ValueError, match=msg):
          le.inverse_transform(mt.tensor([-2, -3, -4]))
  
      # Fail on inverse_transform("")
      msg = r"should be a 1d array.+shape \(\)"
      with pytest.raises(ValueError, match=msg):
          le.inverse_transform("")
  
imports: import numpy
  import pytest
  import scipy.sparse
  from sklearn.preprocessing._label import _inverse_binarize_thresholding
  from sklearn.preprocessing._label import _inverse_binarize_multiclass
  from sklearn.utils._testing import assert_array_equal, ignore_warnings
  from sklearn.utils.multiclass import type_of_target
  from ....None import tensor
  from ..None import LabelBinarizer, label_binarize, LabelEncoder
label_desc: Use image node_id 15 for calling a global function with example usage: test_label_encoder_errors(setup) without return types