code: def test_encode_as_tokens_raises_error_when_input_is_not_string(
      self,
  ) -> None:
      model = self.build_model()
  
      encoder = SentencePieceEncoder(model)
  
      with pytest.raises(
          ValueError,
          match=r"^The input data must be of type `string`, but is of type `int` instead\.$",
      ):
          encoder.encode_as_tokens(123)
  
imports: import pickle
  from pathlib import Path
  from typing import ClassVar, Final, List, Optional, Sequence
  import pytest
  import torch
  from fairseq2.data import CString
  from fairseq2.data.text import SentencePieceDecoder, SentencePieceEncoder, SentencePieceModel
  from fairseq2.typing import DataType
  from tests.common import assert_equal, device
label_desc: Use image node_id 16 for calling the TestSentencePieceModel obj's underlying member method code with example usage: obj.test_encode_as_tokens_raises_error_when_input_is_not_string() without return types