




import os
import unittest

from transformers import FunnelTokenizer, FunnelTokenizerFast
from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin





@require_tokenizers
class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE	,       unittest.TestCase ):


	'''simple docstring'''







	lowercase_       =   FunnelTokenizer
	lowercase_       =   FunnelTokenizerFast
	lowercase_       =   True
	lowercase_       =   True



	def 				lowerCAmelCase_  (							self  :		Tuple						):
							super().setUp()

							SCREAMING_SNAKE_CASE_     						=      [
							    '<unk>',
							    '<cls>',
							    '<sep>',
							    'want',
							    '##want',
							    '##ed',
							    'wa',
							    'un',
							    'runn',
							    '##ing',
							    ',',
							    'low',
							    'lowest',
							]
							SCREAMING_SNAKE_CASE_     						=      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  :		Optional[int]    ,    **_lowerCAmelCase  :		Tuple						):
							return FunnelTokenizer.from_pretrained(self.tmpdirname    ,    **_lowerCAmelCase						)



	def 				lowerCAmelCase_  (							self  :		Dict    ,    **_lowerCAmelCase  :		Optional[Any]						):
							return FunnelTokenizerFast.from_pretrained(self.tmpdirname    ,    **_lowerCAmelCase						)



	def 				lowerCAmelCase_  (							self  :		Union[str, Any]    ,    _lowerCAmelCase  :		int						):
							SCREAMING_SNAKE_CASE_     						=      'UNwant\u00E9d,running'
							SCREAMING_SNAKE_CASE_     						=      'unwanted, running'
							return input_text, output_text



	def 				lowerCAmelCase_  (							self  :		Optional[int]						):
							SCREAMING_SNAKE_CASE_     						=      self.tokenizer_class(self.vocab_file						)

							SCREAMING_SNAKE_CASE_     						=      tokenizer.tokenize('UNwant\u00E9d,running'						)
							self.assertListEqual(_lowerCAmelCase    ,    ['un', '##want', '##ed', ',', 'runn', '##ing']						)
							self.assertListEqual(tokenizer.convert_tokens_to_ids(_lowerCAmelCase						)    ,    [7, 4, 5, 10, 8, 9]						)




	def 				lowerCAmelCase_  (							self  :		Optional[int]						):
							SCREAMING_SNAKE_CASE_     						=      self.get_tokenizers(do_lower_case=_lowerCAmelCase						)
							for tokenizer in tokenizers:
													SCREAMING_SNAKE_CASE_     						=      tokenizer('UNwant\u00E9d,running'						)
													SCREAMING_SNAKE_CASE_     						=      len(inputs['input_ids']						) - 1
													self.assertListEqual(inputs['token_type_ids']    ,    [2] + [0] * sentence_len						)

													SCREAMING_SNAKE_CASE_     						=      tokenizer('UNwant\u00E9d,running'    ,    'UNwant\u00E9d,running'						)
													self.assertListEqual(inputs['token_type_ids']    ,    [2] + [0] * sentence_len + [1] * sentence_len						)





def  UpperCAmelCase_							(				__UpperCAmelCase						:     int      ,      __UpperCAmelCase						:     int							) ->			int:
      return int((input_a, input_a).count(0							) != 0							)

def  UpperCAmelCase_							(				) ->			None:
      assert nand_gate(0      ,      0							) == 1
      assert nand_gate(0      ,      1							) == 1
      assert nand_gate(1      ,      0							) == 1
      assert nand_gate(1      ,      1							) == 0


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