


class   __lowercase						:





							"""simple docstring"""







							class   __lowercase						:





														"""simple docstring"""







														_UpperCAmelCase						     =	"""_prev""", """_data""", """_next"""






														def __init__(			self ,	lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					):





																	"""simple docstring"""




																	SCREAMING_SNAKE_CASE_		:    int 		=				link_p
																	SCREAMING_SNAKE_CASE_		:    List[Any] 		=				element
																	SCREAMING_SNAKE_CASE_		:    Dict 		=				link_n






														def 				UpperCamelCase__    (			self					):





																	"""simple docstring"""




																	return (
																	    F''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
																	)







							def __init__(			self					):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:    Any 		=				self._Node(lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					)
										SCREAMING_SNAKE_CASE_		:    List[Any] 		=				self._Node(lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					)
										SCREAMING_SNAKE_CASE_		:    Union[str, Any] 		=				self._trailer
										SCREAMING_SNAKE_CASE_		:    List[Any] 		=				self._header
										SCREAMING_SNAKE_CASE_		:    Union[str, Any] 		=				0






							def __len__(			self					):





										"""simple docstring"""




										return self._size






							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										return self.__len__() == 0






							def 				UpperCamelCase__    (			self ,	lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:    Union[str, Any] 		=				self._Node(lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					)
										SCREAMING_SNAKE_CASE_		:    Tuple 		=				new_node
										SCREAMING_SNAKE_CASE_		:    Optional[Any] 		=				new_node
										self._size += 1
										return self






							def 				UpperCamelCase__    (			self ,	lowerCAmelCase__					):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:    str 		=				node._prev
										SCREAMING_SNAKE_CASE_		:    str 		=				node._next

										SCREAMING_SNAKE_CASE_		:    str 		=				successor
										SCREAMING_SNAKE_CASE_		:    Tuple 		=				predecessor
										self._size -= 1
										SCREAMING_SNAKE_CASE_		:    Optional[int] 		=				node._data
										SCREAMING_SNAKE_CASE_		:    List[str] 		=				None
										del node
										return temp







class   __lowercase						(_DoublyLinkedBase     ):





							"""simple docstring"""







							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										if self.is_empty():
													raise Exception('List is empty'					)
										return self._header._next._data






							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										if self.is_empty():
													raise Exception('List is empty'					)
										return self._trailer._prev._data






							def 				UpperCamelCase__    (			self ,	lowerCAmelCase__					):





										"""simple docstring"""




										return self._insert(self._header ,	lowerCAmelCase__ ,	self._header._next					)






							def 				UpperCamelCase__    (			self ,	lowerCAmelCase__					):





										"""simple docstring"""




										return self._insert(self._trailer._prev ,	lowerCAmelCase__ ,	self._trailer					)






							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										if self.is_empty():
													raise IndexError('remove_first from empty list'					)
										return self._delete(self._header._next					)






							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										if self.is_empty():
													raise IndexError('remove_first from empty list'					)
										return self._delete(self._trailer._prev					)









from transformers.models.cpm.tokenization_cpm import CpmTokenizer
from transformers.testing_utils import custom_tokenizers

from ..xlnet.test_modeling_xlnet import XLNetModelTest







@custom_tokenizers
class   __lowercase						(__SCREAMING_SNAKE_CASE     ):





							"""simple docstring"""







							def 				UpperCamelCase__    (			self ,	lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__ ,	lowerCAmelCase__					):





										"""simple docstring"""




										return True






							def 				UpperCamelCase__    (			self					):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:    List[str] 		=				CpmTokenizer.from_pretrained('TsinghuaAI/CPM-Generate'					)
										SCREAMING_SNAKE_CASE_		:    int 		=				'Hugging Face大法好，谁用谁知道。'
										SCREAMING_SNAKE_CASE_		:    List[str] 		=				'Hugging Face大法好,谁用谁知道。<unk>'
										SCREAMING_SNAKE_CASE_		:    Union[str, Any] 		=				'▁Hu gg ing ▁ ▂ ▁F ace ▁大法 ▁好 ▁ , ▁谁 ▁用 ▁谁 ▁知 道 ▁ 。'.split()

										SCREAMING_SNAKE_CASE_		:    Union[str, Any] 		=				tokenizer.tokenize(lowerCAmelCase__					)
										self.assertListEqual(lowerCAmelCase__ ,	lowerCAmelCase__					)

										SCREAMING_SNAKE_CASE_		:    Optional[Any] 		=				tokens + [tokenizer.unk_token]

										SCREAMING_SNAKE_CASE_		:    List[Any] 		=				[1_3_7_8_9, 1_3_2_8_3, 1_4_2_1, 8, 1_0, 1_1_6_4, 1_3_6_0_8, 1_6_5_2_8, 6_3, 8, 9, 4_4_0, 1_0_8, 4_4_0, 1_2_1, 9_0, 8, 1_2, 0]
										self.assertListEqual(tokenizer.convert_tokens_to_ids(lowerCAmelCase__					) ,	lowerCAmelCase__					)

										SCREAMING_SNAKE_CASE_		:    List[Any] 		=				tokenizer.decode(lowerCAmelCase__					)
										self.assertEqual(lowerCAmelCase__ ,	lowerCAmelCase__					)





