



"""simple docstring"""







import os
import pickle
import unittest

from transformers import AutoTokenizer
from transformers.models.bert.tokenization_bert import BertTokenizer
from transformers.models.bert_japanese.tokenization_bert_japanese import (
    VOCAB_FILES_NAMES,
    BertJapaneseTokenizer,
    CharacterTokenizer,
    JumanppTokenizer,
    MecabTokenizer,
    SudachiTokenizer,
    WordpieceTokenizer,
)
from transformers.testing_utils import custom_tokenizers, require_jumanpp, require_sudachi

from ...test_tokenization_common import TokenizerTesterMixin






@custom_tokenizers
class      UpperCAmelCase__		(      UpperCamelCase   ,unittest.TestCase     ):
		lowerCAmelCase_       :	int 							=     BertJapaneseTokenizer
		lowerCAmelCase_       :	Dict 							=     False
		lowerCAmelCase_       :	int 							=     True



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






									'''simple docstring'''

									super().setUp()

									A         =					[
									    '[UNK]',
									    '[CLS]',
									    '[SEP]',
									    'こんにちは',
									    'こん',
									    'にちは',
									    'ばんは',
									    '##こん',
									    '##にちは',
									    '##ばんは',
									    '世界',
									    '##世界',
									    '、',
									    '##、',
									    '。',
									    '##。',
									]

									A         =					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 					A_		( self  :    int      ,							snake_case  :    int				)			->						Union[str, Any]:






									'''simple docstring'''

									A         =					'こんにちは、世界。 \nこんばんは、世界。'
									A         =					'こんにちは 、 世界 。 こんばんは 、 世界 。'
									return input_text, output_text



		def 					A_		( self  :    Union[str, Any]      ,							snake_case  :    Optional[int]				)			->						Optional[Any]:






									'''simple docstring'''

									A      ,  A         =					self.get_input_output_texts(snake_case				)
									A         =					tokenizer.encode(snake_case      ,							add_special_tokens=snake_case				)
									A         =					tokenizer.decode(snake_case      ,							clean_up_tokenization_spaces=snake_case				)
									return text, ids



		def 					A_		( self  :    List[str]				)			->						Any:






									'''simple docstring'''

									pass  # TODO add if relevant



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






									'''simple docstring'''

									pass  # TODO add if relevant



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






									'''simple docstring'''

									pass  # TODO add if relevant



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






									'''simple docstring'''

									A         =					self.tokenizer_class(self.vocab_file				)

									A         =					tokenizer.tokenize('こんにちは、世界。\nこんばんは、世界。'				)
									self.assertListEqual(snake_case      ,							['こんにちは', '、', '世界', '。', 'こん', '##ばんは', '、', '世界', '。']				)
									self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case				)      ,							[3, 12, 10, 14, 4, 9, 12, 10, 14]				)



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






									'''simple docstring'''

									A         =					self.tokenizer_class(self.vocab_file      ,							word_tokenizer_type='mecab'				)
									self.assertIsNotNone(snake_case				)

									A         =					'こんにちは、世界。\nこんばんは、世界。'
									A         =					tokenizer.tokenize(snake_case				)
									self.assertListEqual(snake_case      ,							['こんにちは', '、', '世界', '。', 'こん', '##ばんは', '、', '世界', '。']				)
									self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case				)      ,							[3, 12, 10, 14, 4, 9, 12, 10, 14]				)

									A         =					os.path.join(self.tmpdirname      ,							'tokenizer.bin'				)
									with open(snake_case      ,							'wb'				) as handle:
																pickle.dump(snake_case      ,							snake_case				)

									with open(snake_case      ,							'rb'				) as handle:
																A         =					pickle.load(snake_case				)

									A         =					tokenizer_new.tokenize(snake_case				)

									self.assertListEqual(snake_case      ,							snake_case				)



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






									'''simple docstring'''

									A         =					MecabTokenizer(mecab_dic='ipadic'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップルストア', 'で', 'iPhone', '8', 'が', '発売', 'さ', 'れ', 'た', '。']      ,							)



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






									'''simple docstring'''

									try:
																A         =					MecabTokenizer(mecab_dic='unidic_lite'				)
									except ModuleNotFoundError:
																return

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iPhone', '8', 'が', '発売', 'さ', 'れ', 'た', '。']      ,							)



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






									'''simple docstring'''

									try:
																A         =					MecabTokenizer(mecab_dic='unidic'				)
									except ModuleNotFoundError:
																return

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iPhone', '8', 'が', '発売', 'さ', 'れ', 'た', '。']      ,							)



		def 					A_		( self  :    Any				)			->						Any:






									'''simple docstring'''

									A         =					MecabTokenizer(do_lower_case=snake_case      ,							mecab_dic='ipadic'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップルストア', 'で', 'iphone', '8', 'が', '発売', 'さ', 'れ', 'た', '。']      ,							)



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






									'''simple docstring'''

									try:
																A         =					MecabTokenizer(
																    do_lower_case=snake_case      ,							normalize_text=snake_case      ,							mecab_option='-d /usr/local/lib/mecab/dic/jumandic'				)
									except RuntimeError:
																# if dict doesn't exist in the system, previous code raises this error.
																return

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['ｱｯﾌﾟﾙストア', 'で', 'iPhone', '８', 'が', '発売', 'さ', 'れた', '\u3000', '。']      ,							)



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






									'''simple docstring'''

									A         =					MecabTokenizer(normalize_text=snake_case      ,							mecab_dic='ipadic'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['ｱｯﾌﾟﾙストア', 'で', 'iPhone', '８', 'が', '発売', 'さ', 'れ', 'た', '　', '。']      ,							)



		@require_sudachi
		def 					A_		( self  :    Optional[Any]				)			->						Any:






									'''simple docstring'''

									A         =					self.tokenizer_class(self.vocab_file      ,							word_tokenizer_type='sudachi'				)
									self.assertIsNotNone(snake_case				)

									A         =					'こんにちは、世界。\nこんばんは、世界。'
									A         =					tokenizer.tokenize(snake_case				)
									self.assertListEqual(snake_case      ,							['こんにちは', '、', '世界', '。', 'こん', '##ばんは', '、', '世界', '。']				)
									self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case				)      ,							[3, 12, 10, 14, 4, 9, 12, 10, 14]				)

									A         =					os.path.join(self.tmpdirname      ,							'tokenizer.bin'				)
									with open(snake_case      ,							'wb'				) as handle:
																pickle.dump(snake_case      ,							snake_case				)

									with open(snake_case      ,							'rb'				) as handle:
																A         =					pickle.load(snake_case				)

									A         =					tokenizer_new.tokenize(snake_case				)

									self.assertListEqual(snake_case      ,							snake_case				)



		@require_sudachi
		def 					A_		( self  :    Any				)			->						Union[str, Any]:






									'''simple docstring'''

									A         =					SudachiTokenizer(sudachi_dict_type='core'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							[' ', '\t', 'アップル', 'ストア', 'で', 'iPhone', '8', ' ', 'が', ' ', ' ', '\n ', '発売', 'さ', 'れ', 'た', ' ', '。', ' ', ' ']      ,							)



		@require_sudachi
		def 					A_		( self  :    int				)			->						str:






									'''simple docstring'''

									A         =					SudachiTokenizer(sudachi_dict_type='core'      ,							sudachi_split_mode='A'				)

									self.assertListEqual(tokenizer.tokenize('外国人参政権'				)      ,							['外国', '人', '参政', '権']				)



		@require_sudachi
		def 					A_		( self  :    Optional[int]				)			->						Optional[int]:






									'''simple docstring'''

									A         =					SudachiTokenizer(sudachi_dict_type='core'      ,							sudachi_split_mode='B'				)

									self.assertListEqual(tokenizer.tokenize('外国人参政権'				)      ,							['外国人', '参政権']				)



		@require_sudachi
		def 					A_		( self  :    Dict				)			->						List[Any]:






									'''simple docstring'''

									A         =					SudachiTokenizer(sudachi_dict_type='core'      ,							sudachi_split_mode='C'				)

									self.assertListEqual(tokenizer.tokenize('外国人参政権'				)      ,							['外国人参政権']				)



		@require_sudachi
		def 					A_		( self  :    List[str]				)			->						Optional[Any]:






									'''simple docstring'''

									A         =					SudachiTokenizer(do_lower_case=snake_case      ,							sudachi_dict_type='core'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							[' ', '\t', 'アップル', 'ストア', 'で', 'iphone', '8', ' ', 'が', ' ', ' ', '\n ', '発売', 'さ', 'れ', 'た', ' ', '。', ' ', ' ']      ,							)



		@require_sudachi
		def 					A_		( self  :    List[Any]				)			->						List[Any]:






									'''simple docstring'''

									A         =					SudachiTokenizer(normalize_text=snake_case      ,							sudachi_dict_type='core'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							[' ', '\t', 'ｱｯﾌﾟﾙ', 'ストア', 'で', 'iPhone', '８', ' ', 'が', ' ', ' ', '\n ', '発売', 'さ', 'れ', 'た', '\u3000', '。', ' ', ' ']      ,							)



		@require_sudachi
		def 					A_		( self  :    Any				)			->						Optional[Any]:






									'''simple docstring'''

									A         =					SudachiTokenizer(trim_whitespace=snake_case      ,							sudachi_dict_type='core'				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iPhone', '8', 'が', '発売', 'さ', 'れ', 'た', '。']      ,							)



		@require_jumanpp
		def 					A_		( self  :    List[Any]				)			->						List[str]:






									'''simple docstring'''

									A         =					self.tokenizer_class(self.vocab_file      ,							word_tokenizer_type='jumanpp'				)
									self.assertIsNotNone(snake_case				)

									A         =					'こんにちは、世界。\nこんばんは、世界。'
									A         =					tokenizer.tokenize(snake_case				)
									self.assertListEqual(snake_case      ,							['こんにちは', '、', '世界', '。', 'こん', '##ばんは', '、', '世界', '。']				)
									self.assertListEqual(tokenizer.convert_tokens_to_ids(snake_case				)      ,							[3, 12, 10, 14, 4, 9, 12, 10, 14]				)

									A         =					os.path.join(self.tmpdirname      ,							'tokenizer.bin'				)
									with open(snake_case      ,							'wb'				) as handle:
																pickle.dump(snake_case      ,							snake_case				)

									with open(snake_case      ,							'rb'				) as handle:
																A         =					pickle.load(snake_case				)

									A         =					tokenizer_new.tokenize(snake_case				)

									self.assertListEqual(snake_case      ,							snake_case				)



		@require_jumanpp
		def 					A_		( self  :    Any				)			->						Union[str, Any]:






									'''simple docstring'''

									A         =					JumanppTokenizer()

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iPhone', '8', '\u3000', 'が', '\u3000', '\u3000', '\u3000', '発売', 'さ', 'れた', '\u3000', '。']      ,							)



		@require_jumanpp
		def 					A_		( self  :    List[str]				)			->						Tuple:






									'''simple docstring'''

									A         =					JumanppTokenizer(do_lower_case=snake_case				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iphone', '8', '\u3000', 'が', '\u3000', '\u3000', '\u3000', '発売', 'さ', 'れた', '\u3000', '。']      ,							)



		@require_jumanpp
		def 					A_		( self  :    Tuple				)			->						List[Any]:






									'''simple docstring'''

									A         =					JumanppTokenizer(normalize_text=snake_case				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['ｱ', 'ｯ', 'ﾌ', 'ﾟ', 'ﾙ', 'ストア', 'で', 'iPhone', '８', '\u3000', 'が', '\u3000', '\u3000', '\u3000', '発売', 'さ', 'れた', '\u3000', '。']      ,							)



		@require_jumanpp
		def 					A_		( self  :    Union[str, Any]				)			->						Optional[Any]:






									'''simple docstring'''

									A         =					JumanppTokenizer(trim_whitespace=snake_case				)

									self.assertListEqual(
									    tokenizer.tokenize(' \tｱｯﾌﾟﾙストアでiPhone８ が  \n 発売された　。  '				)      ,							['アップル', 'ストア', 'で', 'iPhone', '8', 'が', '発売', 'さ', 'れた', '。']      ,							)



		@require_jumanpp
		def 					A_		( self  :    Optional[int]				)			->						Optional[Any]:






									'''simple docstring'''

									A         =					JumanppTokenizer()

									self.assertListEqual(
									    tokenizer.tokenize('ありがとうございますm(_ _)ｍ見つけるのが大変です。'				)      ,							['ありがとう', 'ございます', 'm(_ _)m', '見つける', 'の', 'が', '大変です', '。']      ,							)



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






									'''simple docstring'''

									A         =					['[UNK]', '[CLS]', '[SEP]', 'こんにちは', 'こん', 'にちは', 'ばんは', '##こん', '##にちは', '##ばんは']

									A         =					{}
									for i, token in enumerate(snake_case				):
																A         =					i
									A         =					WordpieceTokenizer(vocab=snake_case      ,							unk_token='[UNK]'				)

									self.assertListEqual(tokenizer.tokenize(''				)      ,							[]				)

									self.assertListEqual(tokenizer.tokenize('こんにちは'				)      ,							['こんにちは']				)

									self.assertListEqual(tokenizer.tokenize('こんばんは'				)      ,							['こん', '##ばんは']				)

									self.assertListEqual(tokenizer.tokenize('こんばんは こんばんにちは こんにちは'				)      ,							['こん', '##ばんは', '[UNK]', 'こんにちは']				)



		def 					A_		( self  :    Dict				)			->						Any:






									'''simple docstring'''

									A         =					BertJapaneseTokenizer.from_pretrained('nlp-waseda/roberta-base-japanese-with-auto-jumanpp'				)
									A         =					tokenizer.subword_tokenizer

									A         =					subword_tokenizer.tokenize('国境 の 長い トンネル を 抜ける と 雪国 であった 。'				)
									self.assertListEqual(snake_case      ,							['▁国境', '▁の', '▁長い', '▁トンネル', '▁を', '▁抜ける', '▁と', '▁雪', '国', '▁であった', '▁。']				)

									A         =					subword_tokenizer.tokenize('こんばんは こんばん にち は こんにちは'				)
									self.assertListEqual(snake_case      ,							['▁こん', 'ばん', 'は', '▁こん', 'ばん', '▁に', 'ち', '▁は', '▁こんにちは']				)



		def 					A_		( self  :    Dict				)			->						Dict:






									'''simple docstring'''

									A         =					self.tokenizer_class.from_pretrained('cl-tohoku/bert-base-japanese'				)

									A         =					tokenizer.encode('ありがとう。'      ,							add_special_tokens=snake_case				)
									A         =					tokenizer.encode('どういたしまして。'      ,							add_special_tokens=snake_case				)

									A         =					tokenizer.build_inputs_with_special_tokens(snake_case				)
									A         =					tokenizer.build_inputs_with_special_tokens(snake_case      ,							snake_case				)

									# 2 is for "[CLS]", 3 is for "[SEP]"
									assert encoded_sentence == [2] + text + [3]
									assert encoded_pair == [2] + text + [3] + text_a + [3]






@custom_tokenizers
class      UpperCAmelCase__		(      UpperCamelCase   ,unittest.TestCase     ):
		lowerCAmelCase_       :	List[str] 							=     BertJapaneseTokenizer
		lowerCAmelCase_       :	List[str] 							=     False



		def 					A_		( self  :    int				)			->						str:






									'''simple docstring'''

									super().setUp()

									A         =					['[UNK]', '[CLS]', '[SEP]', 'こ', 'ん', 'に', 'ち', 'は', 'ば', '世', '界', '、', '。']

									A         =					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 					A_		( self  :    List[Any]      ,							**snake_case  :    Tuple				)			->						List[str]:






									'''simple docstring'''

									return BertJapaneseTokenizer.from_pretrained(self.tmpdirname      ,							subword_tokenizer_type='character'      ,							**snake_case				)



		def 					A_		( self  :    Optional[Any]      ,							snake_case  :    int				)			->						Optional[int]:






									'''simple docstring'''

									A         =					'こんにちは、世界。 \nこんばんは、世界。'
									A         =					'こ ん に ち は 、 世 界 。 こ ん ば ん は 、 世 界 。'
									return input_text, output_text



		def 					A_		( self  :    Any				)			->						List[Any]:






									'''simple docstring'''

									pass  # TODO add if relevant



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






									'''simple docstring'''

									pass  # TODO add if relevant



		def 					A_		( self  :    Any				)			->						Tuple:






									'''simple docstring'''

									pass  # TODO add if relevant



		def 					A_		( self  :    Optional[Any]				)			->						str:






									'''simple docstring'''

									A         =					self.tokenizer_class(self.vocab_file      ,							subword_tokenizer_type='character'				)

									A         =					tokenizer.tokenize('こんにちは、世界。 \nこんばんは、世界。'				)
									self.assertListEqual(
									    snake_case      ,							['こ', 'ん', 'に', 'ち', 'は', '、', '世', '界', '。', 'こ', 'ん', 'ば', 'ん', 'は', '、', '世', '界', '。']				)
									self.assertListEqual(
									    tokenizer.convert_tokens_to_ids(snake_case				)      ,							[3, 4, 5, 6, 7, 11, 9, 10, 12, 3, 4, 8, 4, 7, 11, 9, 10, 12]				)



		def 					A_		( self  :    List[str]				)			->						Optional[int]:






									'''simple docstring'''

									A         =					['[UNK]', '[CLS]', '[SEP]', 'こ', 'ん', 'に', 'ち', 'は', 'ば', '世', '界', '、', '。']

									A         =					{}
									for i, token in enumerate(snake_case				):
																A         =					i
									A         =					CharacterTokenizer(vocab=snake_case      ,							unk_token='[UNK]'				)

									self.assertListEqual(tokenizer.tokenize(''				)      ,							[]				)

									self.assertListEqual(tokenizer.tokenize('こんにちは'				)      ,							['こ', 'ん', 'に', 'ち', 'は']				)

									self.assertListEqual(tokenizer.tokenize('こんにちほ'				)      ,							['こ', 'ん', 'に', 'ち', '[UNK]']				)



		def 					A_		( self  :    str				)			->						List[Any]:






									'''simple docstring'''

									A         =					self.tokenizer_class.from_pretrained('cl-tohoku/bert-base-japanese-char'				)

									A         =					tokenizer.encode('ありがとう。'      ,							add_special_tokens=snake_case				)
									A         =					tokenizer.encode('どういたしまして。'      ,							add_special_tokens=snake_case				)

									A         =					tokenizer.build_inputs_with_special_tokens(snake_case				)
									A         =					tokenizer.build_inputs_with_special_tokens(snake_case      ,							snake_case				)

									# 2 is for "[CLS]", 3 is for "[SEP]"
									assert encoded_sentence == [2] + text + [3]
									assert encoded_pair == [2] + text + [3] + text_a + [3]






@custom_tokenizers
class      UpperCAmelCase__		(      unittest.TestCase     ):



		def 					A_		( self  :    Any				)			->						List[str]:






									'''simple docstring'''

									A         =					'cl-tohoku/bert-base-japanese'
									A         =					AutoTokenizer.from_pretrained(snake_case				)
									self.assertIsInstance(snake_case      ,							snake_case				)






class      UpperCAmelCase__		(      unittest.TestCase     ):



		def 					A_		( self  :    Optional[Any]				)			->						Dict:






									'''simple docstring'''

									A         =					'cl-tohoku/bert-base-japanese'
									with self.assertLogs('transformers'      ,							level='WARNING'				) as cm:
																BertTokenizer.from_pretrained(snake_case				)
																self.assertTrue(
																    cm.records[0].message.startswith(
																        'The tokenizer class you load from this checkpoint is not the same type as the class this function'
																        ' is called from.'				)				)
									A         =					'bert-base-cased'
									with self.assertLogs('transformers'      ,							level='WARNING'				) as cm:
																BertJapaneseTokenizer.from_pretrained(snake_case				)
																self.assertTrue(
																    cm.records[0].message.startswith(
																        'The tokenizer class you load from this checkpoint is not the same type as the class this function'
																        ' is called from.'				)				)








"""simple docstring"""







from datasets.utils.patching import _PatchedModuleObj, patch_submodule

from . import _test_patching

def   lowerCAmelCase__			(     ) ->							Optional[Any]:
							import os as original_os
							from os import path as original_path
							from os import rename as original_rename
							from os.path import dirname as original_dirname
							from os.path import join as original_join

							assert _test_patching.os is original_os
							assert _test_patching.path is original_path
							assert _test_patching.join is original_join

							assert _test_patching.renamed_os is original_os
							assert _test_patching.renamed_path is original_path
							assert _test_patching.renamed_join is original_join

							A         =					'__test_patch_submodule_mock__'
							with patch_submodule(_test_patching				,      'os.path.join'				,      lowerCamelCase__			):
														# Every way to access os.path.join must be patched, and the rest must stay untouched

														# check os.path.join
														assert isinstance(_test_patching.os				,      _PatchedModuleObj			)
														assert isinstance(_test_patching.os.path				,      _PatchedModuleObj			)
														assert _test_patching.os.path.join is mock

														# check path.join
														assert isinstance(_test_patching.path				,      _PatchedModuleObj			)
														assert _test_patching.path.join is mock

														# check join
														assert _test_patching.join is mock

														# check that the other attributes are untouched
														assert _test_patching.os.rename is original_rename
														assert _test_patching.path.dirname is original_dirname
														assert _test_patching.os.path.dirname is original_dirname

														# Even renamed modules or objects must be patched

														# check renamed_os.path.join
														assert isinstance(_test_patching.renamed_os				,      _PatchedModuleObj			)
														assert isinstance(_test_patching.renamed_os.path				,      _PatchedModuleObj			)
														assert _test_patching.renamed_os.path.join is mock

														# check renamed_path.join
														assert isinstance(_test_patching.renamed_path				,      _PatchedModuleObj			)
														assert _test_patching.renamed_path.join is mock

														# check renamed_join
														assert _test_patching.renamed_join is mock

														# check that the other attributes are untouched
														assert _test_patching.renamed_os.rename is original_rename
														assert _test_patching.renamed_path.dirname is original_dirname
														assert _test_patching.renamed_os.path.dirname is original_dirname

							# check that everthing is back to normal when the patch is over

							assert _test_patching.os is original_os
							assert _test_patching.path is original_path
							assert _test_patching.join is original_join

							assert _test_patching.renamed_os is original_os
							assert _test_patching.renamed_path is original_path
							assert _test_patching.renamed_join is original_join

def   lowerCAmelCase__			(     ) ->							str:
							assert _test_patching.open is open

							A         =					'__test_patch_submodule_builtin_mock__'
							# _test_patching has "open" in its globals
							assert _test_patching.open is open
							with patch_submodule(_test_patching				,      'open'				,      lowerCamelCase__			):
														assert _test_patching.open is mock

							# check that everthing is back to normal when the patch is over

							assert _test_patching.open is open

def   lowerCAmelCase__			(     ) ->							List[Any]:
							# pandas.read_csv is not present in _test_patching
							A         =					'__test_patch_submodule_missing_mock__'
							with patch_submodule(_test_patching				,      'pandas.read_csv'				,      lowerCamelCase__			):
														pass

def   lowerCAmelCase__			(     ) ->							Union[str, Any]:
							# builtin should always be mocked even if they're not in the globals
							# in case they're loaded at one point
							A         =					'__test_patch_submodule_missing_builtin_mock__'
							# _test_patching doesn't have "len" in its globals
							assert getattr(_test_patching				,      'len'				,      lowerCamelCase__			) is None
							with patch_submodule(_test_patching				,      'len'				,      lowerCamelCase__			):
														assert _test_patching.len is mock
							assert _test_patching.len is len

def   lowerCAmelCase__			(     ) ->							Union[str, Any]:
							A         =					'__test_patch_submodule_start_and_stop_mock__'
							A         =					patch_submodule(_test_patching				,      'open'				,      lowerCamelCase__			)
							assert _test_patching.open is open
							patch.start()
							assert _test_patching.open is mock
							patch.stop()
							assert _test_patching.open is open

def   lowerCAmelCase__			(     ) ->							int:
							from os import rename as original_rename
							from os.path import dirname as original_dirname
							from os.path import join as original_join

							A         =					'__test_patch_submodule_successive_join__'
							A         =					'__test_patch_submodule_successive_dirname__'
							A         =					'__test_patch_submodule_successive_rename__'
							assert _test_patching.os.path.join is original_join
							assert _test_patching.os.path.dirname is original_dirname
							assert _test_patching.os.rename is original_rename

							with patch_submodule(_test_patching				,      'os.path.join'				,      lowerCamelCase__			):
														with patch_submodule(_test_patching				,      'os.rename'				,      lowerCamelCase__			):
																					with patch_submodule(_test_patching				,      'os.path.dirname'				,      lowerCamelCase__			):
																												assert _test_patching.os.path.join is mock_join
																												assert _test_patching.os.path.dirname is mock_dirname
																												assert _test_patching.os.rename is mock_rename

    # try another order
							with patch_submodule(_test_patching				,      'os.rename'				,      lowerCamelCase__			):
														with patch_submodule(_test_patching				,      'os.path.join'				,      lowerCamelCase__			):
																					with patch_submodule(_test_patching				,      'os.path.dirname'				,      lowerCamelCase__			):
																												assert _test_patching.os.path.join is mock_join
																												assert _test_patching.os.path.dirname is mock_dirname
																												assert _test_patching.os.rename is mock_rename

							assert _test_patching.os.path.join is original_join
							assert _test_patching.os.path.dirname is original_dirname
							assert _test_patching.os.rename is original_rename

def   lowerCAmelCase__			(     ) ->							Optional[Any]:
							A         =					'__test_patch_submodule_doesnt_exist_mock__'
							with patch_submodule(_test_patching				,      '__module_that_doesn_exist__.__attribute_that_doesn_exist__'				,      lowerCamelCase__			):
														pass
							with patch_submodule(_test_patching				,      'os.__attribute_that_doesn_exist__'				,      lowerCamelCase__			):
														pass



