






"""simple docstring"""


import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


__SCREAMING_SNAKE_CASE      =      '\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] After open-sourcing the model behind the chatbot, the company pivoted to focus on being a platform for machine learning.\n\nIn March 2021, Hugging Face raised $40 million in a Series B funding round.[3]\n\nOn April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model.[4] In 2022, the workshop concluded with the announcement of BLOOM, a multilingual large language model with 176 billion parameters.[5]\n'




class 	__UpperCamelCase    (    unittest.TestCase      ,    UpperCamelCase	):
					def 					UpperCAmelCase__   (       self       :  Dict      )  ->					Union[str, Any]:
											lowerCAmelCase      :List[str]				  = load_tool('summarization'      )
											self.tool.setup()
											lowerCAmelCase      :Optional[int]				  = load_tool('summarization'    ,   remote=UpperCAmelCase      )
					def 					UpperCAmelCase__   (       self       :  List[str]      )  ->					str:
											lowerCAmelCase      :Optional[int]				  = self.tool(UpperCAmelCase      )
											self.assertEqual(
											    UpperCAmelCase    ,   'Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM.'    ,   )
					def 					UpperCAmelCase__   (       self       :  Dict      )  ->					Optional[Any]:
											lowerCAmelCase      :Dict				  = self.remote_tool(UpperCAmelCase      )
											self.assertEqual(
											    UpperCAmelCase    ,   'Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM.'    ,   )
					def 					UpperCAmelCase__   (       self       :  str      )  ->					Optional[int]:
											lowerCAmelCase      :Optional[Any]				  = self.tool(text=UpperCAmelCase      )
											self.assertEqual(
											    UpperCAmelCase    ,   'Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM.'    ,   )
					def 					UpperCAmelCase__   (       self       :  int      )  ->					Tuple:
											lowerCAmelCase      :int				  = self.remote_tool(text=UpperCAmelCase      )
											self.assertEqual(
											    UpperCAmelCase    ,   'Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM.'    ,   )







"""simple docstring"""


import unittest
import warnings
from dataclasses import dataclass

from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir




@dataclass
class 	__UpperCamelCase    :
					lowercase_						:							str




class 	__UpperCamelCase    (    unittest.TestCase	):
					def 					UpperCAmelCase__   (       self       :  Union[str, Any]      )  ->					Optional[Any]:
											lowerCAmelCase      :List[str]				  = get_tests_dir('fixtures/test_sentencepiece.model'      )
											lowerCAmelCase      :Tuple				  = get_tests_dir('fixtures/test_sentencepiece_with_bytefallback.model'      )

											lowerCAmelCase      :List[str]				  = FakeOriginalTokenizer(vocab_file=UpperCAmelCase      )

											with warnings.catch_warnings(record=UpperCAmelCase      ) as w:
																	lowerCAmelCase      :Dict				  = SpmConverter(UpperCAmelCase      )
											self.assertEqual(len(UpperCAmelCase      )    ,   0      )

											lowerCAmelCase      :int				  = FakeOriginalTokenizer(vocab_file=UpperCAmelCase      )

											with warnings.catch_warnings(record=UpperCAmelCase      ) as w:
																	lowerCAmelCase      :List[str]				  = SpmConverter(UpperCAmelCase      )
											self.assertEqual(len(UpperCAmelCase      )    ,   1      )

											self.assertIn(
											    'The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option'
											    ' which is not implemented in the fast tokenizers.'    ,   str(w[0].message      )    ,   )