

import pytest

import datasets


# Import fixture modules as plugins
a__												=						['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec''']



def   __UpperCAmelCase					(      __a :     Dict						,__a :     Dict      )     ->	List[str]:

					"""simple docstring"""

					for item in items:
										if any(marker in item.keywords for marker in ['''integration''', '''unit''']      ):
															continue
										item.add_marker(pytest.mark.unit      )



def   __UpperCAmelCase					(      __a :     Tuple      )     ->	Optional[Any]:

					"""simple docstring"""

					config.addinivalue_line('''markers'''						,'''torchaudio_latest: mark test to run with torchaudio>=0.12'''      )



@pytest.fixture(autouse=__a      )
def   __UpperCAmelCase					(      __a :     List[Any]						,__a :     Dict      )     ->	str:

					"""simple docstring"""

					_a      :       Any   =						tmp_path_factory.getbasetemp() / '''cache'''
					_a      :       Dict   =						test_hf_cache_home / '''datasets'''
					_a      :       Optional[int]   =						test_hf_cache_home / '''metrics'''
					_a      :       List[str]   =						test_hf_cache_home / '''modules'''
					monkeypatch.setattr('''datasets.config.HF_DATASETS_CACHE'''						,str(__a      )      )
					monkeypatch.setattr('''datasets.config.HF_METRICS_CACHE'''						,str(__a      )      )
					monkeypatch.setattr('''datasets.config.HF_MODULES_CACHE'''						,str(__a      )      )
					_a      :       List[Any]   =						test_hf_datasets_cache / '''downloads'''
					monkeypatch.setattr('''datasets.config.DOWNLOADED_DATASETS_PATH'''						,str(__a      )      )
					_a      :       List[str]   =						test_hf_datasets_cache / '''downloads''' / '''extracted'''
					monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH'''						,str(__a      )      )



@pytest.fixture(autouse=__a						,scope='''session'''      )
def   __UpperCAmelCase					(      )     ->	List[str]:

					"""simple docstring"""

					datasets.disable_progress_bar()



@pytest.fixture(autouse=__a      )
def   __UpperCAmelCase					(      __a :     List[Any]      )     ->	Dict:

					"""simple docstring"""

					monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'''						,__a      )







@pytest.fixture
def   __UpperCAmelCase					(      __a :     Optional[int]      )     ->	int:

					"""simple docstring"""

					monkeypatch.setattr('''sqlalchemy.util.deprecations.SILENCE_UBER_WARNING'''						,__a      )






import os
import unittest

from transformers import LxmertTokenizer, LxmertTokenizerFast
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin

@require_tokenizers
class 							UpperCAmelCase_						(     __lowercase							,			unittest.TestCase  ):
							"""simple docstring"""







							UpperCAmelCase__			:		Any             =       LxmertTokenizer
							UpperCAmelCase__			:		Optional[Any]             =       LxmertTokenizerFast
							UpperCAmelCase__			:		Any             =       True
							UpperCAmelCase__			:		Dict             =       True


							def 							__lowercase							(     self			)       ->       Union[str, Any]:
												super().setUp()

												_a      :       int   =						[
												    '''[UNK]''',
												    '''[CLS]''',
												    '''[SEP]''',
												    '''want''',
												    '''##want''',
												    '''##ed''',
												    '''wa''',
												    '''un''',
												    '''runn''',
												    '''##ing''',
												    ''',''',
												    '''low''',
												    '''lowest''',
												]
												_a      :       Any   =						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 							__lowercase							(     self			,				_a			)       ->       List[str]:
												_a      :       Tuple   =						'''UNwant\u00E9d,running'''
												_a      :       str   =						'''unwanted, running'''
												return input_text, output_text


							def 							__lowercase							(     self			)       ->       List[Any]:
												_a      :       str   =						self.tokenizer_class(self.vocab_file			)

												_a      :       str   =						tokenizer.tokenize('''UNwant\u00E9d,running'''			)
												self.assertListEqual(_a			,				['''un''', '''##want''', '''##ed''', ''',''', '''runn''', '''##ing''']			)
												self.assertListEqual(tokenizer.convert_tokens_to_ids(_a			)			,				[7, 4, 5, 1_0, 8, 9]			)




							def 							__lowercase							(     self			)       ->       List[Any]:
												if not self.test_rust_tokenizer:
																	return

												_a      :       Optional[Any]   =						self.get_tokenizer()
												_a      :       str   =						self.get_rust_tokenizer()

												_a      :       Optional[Any]   =						'''I was born in 92000, and this is falsé.'''

												_a      :       Optional[Any]   =						tokenizer.tokenize(_a			)
												_a      :       List[Any]   =						rust_tokenizer.tokenize(_a			)
												self.assertListEqual(_a			,				_a			)

												_a      :       List[Any]   =						tokenizer.encode(_a			,				add_special_tokens=_a			)
												_a      :       Any   =						rust_tokenizer.encode(_a			,				add_special_tokens=_a			)
												self.assertListEqual(_a			,				_a			)

												_a      :       Dict   =						self.get_rust_tokenizer()
												_a      :       Optional[int]   =						tokenizer.encode(_a			)
												_a      :       Dict   =						rust_tokenizer.encode(_a			)
												self.assertListEqual(_a			,				_a			)



