






import os
import unittest

from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer

from ...test_tokenization_common import TokenizerTesterMixin

class 		lowerCAmelCase     ( __a      ,       unittest.TestCase			):

					'''simple docstring'''

					_A						:			Dict									=      TransfoXLTokenizer
					_A						:			Optional[int]									=      False
					_A						:			Optional[int]									=      False



					def       lowerCAmelCase				(  self				:	Optional[int]							)			->  List[Any]:


												"""simple docstring"""

												super().setUp()

												__lowercase      :							Union[str, Any]				=     [
												    """<unk>""",
												    """[CLS]""",
												    """[SEP]""",
												    """want""",
												    """unwanted""",
												    """wa""",
												    """un""",
												    """running""",
												    """,""",
												    """low""",
												    """l""",
												]
												__lowercase      :							Dict				=     os.path.join(self.tmpdirname		,     VOCAB_FILES_NAMES["""vocab_file"""]							)
												with open(self.vocab_file		,     """w"""		,     encoding="""utf-8"""							) as vocab_writer:
																			vocab_writer.write("""""".join([x + """\n""" for x in vocab_tokens]							)							)



					def       lowerCAmelCase				(  self				:	List[str]		,     **__a				:	Tuple							)			->  List[str]:


												"""simple docstring"""

												__lowercase      :							List[Any]				=     True
												return TransfoXLTokenizer.from_pretrained(self.tmpdirname		,     **__a							)



					def       lowerCAmelCase				(  self				:	Optional[Any]		,     __a				:	List[Any]							)			->  Optional[int]:


												"""simple docstring"""

												__lowercase      :							Any				=     """<unk> UNwanted , running"""
												__lowercase      :							Dict				=     """<unk> unwanted, running"""
												return input_text, output_text



					def       lowerCAmelCase				(  self				:	str							)			->  Dict:


												"""simple docstring"""

												__lowercase      :							Optional[Any]				=     TransfoXLTokenizer(vocab_file=self.vocab_file		,     lower_case=__a							)

												__lowercase      :							str				=     tokenizer.tokenize("""<unk> UNwanted , running"""							)
												self.assertListEqual(__a		,     ["""<unk>""", """unwanted""", """,""", """running"""]							)

												self.assertListEqual(tokenizer.convert_tokens_to_ids(__a							)		,     [0, 4, 8, 7]							)



					def       lowerCAmelCase				(  self				:	str							)			->  Union[str, Any]:


												"""simple docstring"""

												__lowercase      :							Union[str, Any]				=     TransfoXLTokenizer(lower_case=__a							)

												self.assertListEqual(
												    tokenizer.tokenize(""" \tHeLLo ! how  \n Are yoU ?  """							)		,     ["""hello""", """!""", """how""", """are""", """you""", """?"""]							)



					def       lowerCAmelCase				(  self				:	Optional[int]							)			->  Optional[int]:


												"""simple docstring"""

												__lowercase      :							str				=     TransfoXLTokenizer(lower_case=__a							)

												self.assertListEqual(
												    tokenizer.tokenize(""" \tHeLLo ! how  \n Are yoU ?  """							)		,     ["""HeLLo""", """!""", """how""", """Are""", """yoU""", """?"""]							)



					def       lowerCAmelCase				(  self				:	Dict							)			->  int:


												"""simple docstring"""

												__lowercase      :							Optional[int]				=     TransfoXLTokenizer(lower_case=__a							)
												__lowercase      :							Optional[int]				=     """Hello (bracket) and side-scrolled [and] Henry's $5,000 with 3.34 m. What's up!?"""
												__lowercase      :							Dict				=     [
												    """Hello""",
												    """(""",
												    """bracket""",
												    """)""",
												    """and""",
												    """side""",
												    """@-@""",
												    """scrolled""",
												    """[""",
												    """and""",
												    """]""",
												    """Henry""",
												    """'s""",
												    """$""",
												    """5""",
												    """@,@""",
												    """000""",
												    """with""",
												    """3""",
												    """@.@""",
												    """34""",
												    """m""",
												    """.""",
												    """What""",
												    """'s""",
												    """up""",
												    """!""",
												    """?""",
												]

												self.assertListEqual(tokenizer.tokenize(__a							)		,     __a							)

												self.assertEqual(tokenizer.convert_tokens_to_string(__a							)		,     __a							)



					def       lowerCAmelCase				(  self				:	Tuple							)			->  Optional[Any]:


												"""simple docstring"""

												__lowercase      :							Tuple				=     self.get_tokenizer()
												__lowercase      :							str				=     len(__a							)

												tokenizer.add_tokens(["""new1""", """new2"""]							)
												tokenizer.move_added_token("""new1"""		,     1							)

												# Check that moved token is not copied (duplicate)
												self.assertEqual(len(__a							)		,     original_len + 2							)
												# Check that token is moved to specified id
												self.assertEqual(tokenizer.encode("""new1"""							)		,     [1]							)
												self.assertEqual(tokenizer.decode([1]							)		,     """new1"""							)







def       snake_case_		(     lowerCAmelCase_       :						int       ,       lowerCAmelCase_       :						int      ):
							return int((input_a, input_a).count(1      ) != 0      )
def       snake_case_		(     ):
							assert or_gate(0       ,       0      ) == 0
							assert or_gate(0       ,       1      ) == 1
							assert or_gate(1       ,       0      ) == 1
							assert or_gate(1       ,       1      ) == 1


if __name__ == "__main__":
	print(or_gate(0, 1))
	print(or_gate(1, 0))
	print(or_gate(0, 0))
	print(or_gate(1, 1))