class_docstr: Test case for SentencePieceProcessor
class_docstr_tok: ["Test","case","for","SentencePieceProcessor"]
code: def test_serialized_proto(self):
      text = "I saw a girl with a telescope."
      s1 = self.sp_.EncodeAsSerializedProto(text)
      s2 = self.sp_.SampleEncodeAsSerializedProto(text, 10, 0.2)
      s3 = self.sp_.NBestEncodeAsSerializedProto(text, 10)
      s4 = self.sp_.DecodePiecesAsSerializedProto(["foo", "bar"])
      s5 = self.sp_.DecodeIdsAsSerializedProto([20, 30])
  
      t1 = self.sp_.encode_as_serialized_proto(text)
      t2 = self.sp_.sample_encode_as_serialized_proto(text, 10, 0.2)
      t3 = self.sp_.nbest_encode_as_serialized_proto(text, 10)
      t4 = self.sp_.decode_pieces_as_serialized_proto(["foo", "bar"])
      t5 = self.sp_.decode_ids_as_serialized_proto([20, 30])
  
      y1 = self.sp_.encode(text, out_type="serialized_proto")
      y2 = self.sp_.encode(
          text, enable_sampling=True, out_type="serialized_proto"
      )
      y3 = self.sp_.nbest_encode(
          text, out_type="serialized_proto", nbest_size=10
      )
      y4 = self.sp_.decode(["foo", "bar"], out_type="serialized_proto")
      y5 = self.sp_.decode([20, 30], out_type="serialized_proto")
  
      self.assertEqual(type(s1), bytes)
      self.assertEqual(type(s2), bytes)
      self.assertEqual(type(t2), bytes)
      self.assertEqual(type(s3), bytes)
      self.assertEqual(type(s4), bytes)
      self.assertEqual(type(s5), bytes)
  
      self.assertEqual(s1, t1)
      self.assertEqual(s3, t3)
      self.assertEqual(s4, t4)
      self.assertEqual(s5, t5)
      self.assertEqual(s1, y1)
      self.assertEqual(s3, y3)
      self.assertEqual(s4, y4)
      self.assertEqual(s5, y5)
  
      ids = self.jasp_.EncodeAsIds(text)
      pieces = self.jasp_.EncodeAsPieces(text)
      s1 = self.jasp_.EncodeAsSerializedProto(text)
      s2 = self.jasp_.DecodeIdsAsSerializedProto(ids)
      s3 = self.jasp_.DecodePiecesAsSerializedProto(ids)
      self.assertEqual(s2, s1)
      self.assertEqual(s3, s1)
  
imports: from collections import defaultdict
  import io
  import os
  import pickle
  import sys
  import unittest
  import sentencepiece
label_desc: Use image node_id 9 for calling the TestSentencepieceProcessor obj's underlying member method code with example usage: obj.test_serialized_proto() without return types