
import unittest

from transformers import GPTNeoXJapaneseConfig, is_torch_available
from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import GPTNeoXJapaneseForCausalLM, GPTNeoXJapaneseModel


class        lowercase      :



		def __init__(				self       ,   A_       ,   A_=13       ,   A_=7       ,   A_=True       ,   A_=True       ,   A_=True       ,   A_=True       ,   A_=99       ,   A_=32       ,   A_=5       ,   A_=4       ,   A_=4       ,   A_="gelu"       ,   A_=0.0       ,   A_=0.1       ,   A_=True       ,   A_=512       ,   A_=16       ,   A_=2       ,   A_=0.02       ,   A_=3       ,   A_=4       ,   A_=None       ,   )						->      Any:
				"""simple docstring"""
				UpperCamelCase						=  parent
				UpperCamelCase						=  batch_size
				UpperCamelCase						=  seq_length
				UpperCamelCase						=  is_training
				UpperCamelCase						=  use_input_mask
				UpperCamelCase						=  use_token_type_ids
				UpperCamelCase						=  use_labels
				UpperCamelCase						=  vocab_size
				UpperCamelCase						=  hidden_size
				UpperCamelCase						=  num_hidden_layers
				UpperCamelCase						=  num_attention_heads
				UpperCamelCase						=  intermediate_multiple_size
				UpperCamelCase						=  hidden_act
				UpperCamelCase						=  hidden_dropout
				UpperCamelCase						=  attention_dropout
				UpperCamelCase						=  weight_tying
				UpperCamelCase						=  max_position_embeddings
				UpperCamelCase						=  type_vocab_size
				UpperCamelCase						=  type_sequence_label_size
				UpperCamelCase						=  initializer_range
				UpperCamelCase						=  num_labels
				UpperCamelCase						=  num_choices
				UpperCamelCase						=  scope



		def __UpperCamelCase				(				self )						->      List[Any]:
				"""simple docstring"""
				UpperCamelCase						=  ids_tensor([self.batch_size, self.seq_length]       ,   self.vocab_size )

				UpperCamelCase						=  None
				if self.use_input_mask:
						UpperCamelCase						=  random_attention_mask([self.batch_size, self.seq_length] )

				UpperCamelCase						=  None
				if self.use_labels:
						UpperCamelCase						=  ids_tensor([self.batch_size, self.seq_length]       ,   self.num_labels )

				UpperCamelCase						=  self.get_config()

				return config, input_ids, input_mask, token_labels



		def __UpperCamelCase				(				self )						->      Any:
				"""simple docstring"""
				return GPTNeoXJapaneseConfig(
				    vocab_size=self.vocab_size       ,   hidden_size=self.hidden_size       ,   num_hidden_layers=self.num_hidden_layers       ,   num_attention_heads=self.num_attention_heads       ,   intermediate_multiple_size=self.intermediate_multiple_size       ,   hidden_act=self.hidden_act       ,   hidden_dropout=self.hidden_dropout       ,   attention_dropout=self.attention_dropout       ,   weight_tying=self.weight_tying       ,   max_position_embeddings=self.max_position_embeddings       ,   type_vocab_size=self.type_vocab_size       ,   is_decoder=A_       ,   initializer_range=self.initializer_range       ,   )



		def __UpperCamelCase				(				self )						->      Any:
				"""simple docstring"""
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  self.prepare_config_and_inputs()

				UpperCamelCase						=  True

				return config, input_ids, input_mask, token_labels



		def __UpperCamelCase				(				self       ,   A_       ,   A_       ,   A_ )						->      Optional[int]:
				"""simple docstring"""
				UpperCamelCase						=  GPTNeoXJapaneseModel(config=A_ )
				model.to(A_ )
				model.eval()
				UpperCamelCase						=  model(A_       ,   attention_mask=A_ )
				UpperCamelCase						=  model(A_ )
				self.parent.assertEqual(result.last_hidden_state.shape       ,   (self.batch_size, self.seq_length, self.hidden_size) )



		def __UpperCamelCase				(				self       ,   A_       ,   A_       ,   A_ )						->      Any:
				"""simple docstring"""
				UpperCamelCase						=  True
				UpperCamelCase						=  GPTNeoXJapaneseModel(A_ )
				model.to(A_ )
				model.eval()
				UpperCamelCase						=  model(A_       ,   attention_mask=A_ )
				self.parent.assertEqual(result.last_hidden_state.shape       ,   (self.batch_size, self.seq_length, self.hidden_size) )



		def __UpperCamelCase				(				self       ,   A_       ,   A_       ,   A_       ,   A_ )						->      Any:
				"""simple docstring"""
				UpperCamelCase						=  GPTNeoXJapaneseForCausalLM(config=A_ )
				model.to(A_ )
				model.eval()
				UpperCamelCase						=  model(A_       ,   attention_mask=A_       ,   labels=A_ )
				self.parent.assertEqual(result.logits.shape       ,   (self.batch_size, self.seq_length, self.vocab_size) )



		def __UpperCamelCase				(				self       ,   A_       ,   A_       ,   A_ )						->      List[Any]:
				"""simple docstring"""
				UpperCamelCase						=  True
				UpperCamelCase						=  GPTNeoXJapaneseForCausalLM(config=A_ )
				model.to(A_ )
				model.eval()

				# first forward pass
				UpperCamelCase						=  model(A_       ,   attention_mask=A_       ,   use_cache=A_ )
				UpperCamelCase						=  outputs.past_key_values

				# create hypothetical multiple next token and extent to next_input_ids
				UpperCamelCase						=  ids_tensor((self.batch_size, 3)       ,   config.vocab_size )
				UpperCamelCase						=  ids_tensor((self.batch_size, 3)       ,   vocab_size=2 )

				# append to next input_ids and
				UpperCamelCase						=  torch.cat([input_ids, next_tokens]       ,   dim=-1 )
				UpperCamelCase						=  torch.cat([input_mask, next_mask]       ,   dim=-1 )

				UpperCamelCase						=  model(A_       ,   attention_mask=A_       ,   output_hidden_states=A_ )
				UpperCamelCase						=  output_from_no_past['hidden_states'][0]
				UpperCamelCase						=  model(
				    A_       ,   attention_mask=A_       ,   past_key_values=A_       ,   output_hidden_states=A_       ,   )['hidden_states'][0]

				# select random slice
				UpperCamelCase						=  ids_tensor((1,)       ,   output_from_past.shape[-1] ).item()
				UpperCamelCase						=  output_from_no_past[:, -3:, random_slice_idx].detach()
				UpperCamelCase						=  output_from_past[:, :, random_slice_idx].detach()

				self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1] )

				# test that outputs are equal for slice
				self.parent.assertTrue(torch.allclose(A_       ,   A_       ,   atol=1e-3 ) )



		def __UpperCamelCase				(				self )						->      int:
				"""simple docstring"""
				UpperCamelCase						=  self.prepare_config_and_inputs()
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  config_and_inputs
				UpperCamelCase						=  {'input_ids': input_ids, 'attention_mask': input_mask}
				return config, inputs_dict






@require_torch
class        lowercase      (	_SCREAMING_SNAKE_CASE						,     _SCREAMING_SNAKE_CASE						,     unittest.TestCase     ):
		__lowercase : int			  =       (GPTNeoXJapaneseModel, GPTNeoXJapaneseForCausalLM) if is_torch_available() else ()
		__lowercase : Any			  =       (GPTNeoXJapaneseForCausalLM,) if is_torch_available() else ()
		__lowercase : Union[str, Any]			  =       (
		    {"feature-extraction": GPTNeoXJapaneseModel, "text-generation": GPTNeoXJapaneseForCausalLM}
		    if is_torch_available()
		    else {}
		)
		__lowercase : str			  =       False
		__lowercase : Optional[Any]			  =       False
		__lowercase : Any			  =       False
		__lowercase : Optional[int]			  =       False



		def __UpperCamelCase				(				self )						->      List[Any]:
				"""simple docstring"""
				UpperCamelCase						=  GPTNeoXJapaneseModelTester(self )
				UpperCamelCase						=  ConfigTester(self       ,   config_class=A_       ,   hidden_size=37 )



		def __UpperCamelCase				(				self )						->      int:
				"""simple docstring"""
				self.config_tester.run_common_tests()



		def __UpperCamelCase				(				self )						->      str:
				"""simple docstring"""
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_model(A_       ,   A_       ,   A_ )



		def __UpperCamelCase				(				self )						->      int:
				"""simple docstring"""
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  self.model_tester.prepare_config_and_inputs_for_decoder()
				self.model_tester.create_and_check_model_as_decoder(A_       ,   A_       ,   A_ )



		def __UpperCamelCase				(				self )						->      Optional[int]:
				"""simple docstring"""
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  self.model_tester.prepare_config_and_inputs_for_decoder()

				UpperCamelCase						=  None

				self.model_tester.create_and_check_model_as_decoder(A_       ,   A_       ,   A_ )



		def __UpperCamelCase				(				self )						->      Union[str, Any]:
				"""simple docstring"""
				UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase			,						UpperCamelCase						=  self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_decoder_model_past_large_inputs(A_       ,   A_       ,   A_ )



		def __UpperCamelCase				(				self )						->      List[str]:
				"""simple docstring"""
				UpperCamelCase						=  self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_for_causal_lm(*A_ )



		@slow
		def __UpperCamelCase				(				self )						->      Union[str, Any]:
				"""simple docstring"""
				UpperCamelCase						=  'abeja/gpt-neox-japanese-2.7b'

				UpperCamelCase						=  ['データサイエンティストとは、', '100年後に必要とされる会社は、', 'フルリモートの環境で働くために必要なことは、', '国境の長いトンネルを抜けると', '美味しい日本食といえば、']

				UpperCamelCase						=  [
				    'データサイエンティストとは、データを分析し、ビジネスに役立つ知見を導き出す専門家のことです。',
				    '100年後に必要とされる会社は、「人」が中心の会社です。',
				    'フルリモートの環境で働くために必要なことは、「自分の時間をコントロールする」ことです。',
				    '国境の長いトンネルを抜けると、そこは雪国だった。',
				    '美味しい日本食といえば、やっぱりお寿司ですよね。',
				]

				UpperCamelCase						=  GPTNeoXJapaneseTokenizer.from_pretrained(A_ )
				UpperCamelCase						=  GPTNeoXJapaneseForCausalLM.from_pretrained(A_ )

				UpperCamelCase						=  []
				for prompt in prompts:
						UpperCamelCase						=  tokenizer(A_       ,   return_tensors='pt' ).input_ids
						UpperCamelCase						=  model.generate(A_       ,   max_length=50 )
						UpperCamelCase						=  tokenizer.batch_decode(A_       ,   skip_special_tokens=A_ )
						predicted_outputs += generated_string
				self.assertListEqual(A_       ,   A_ )


import os
import sys
import tempfile
import unittest
import unittest.mock as mock
from pathlib import Path

from huggingface_hub import HfFolder, delete_repo
from huggingface_hub.file_download import http_get
from requests.exceptions import HTTPError

from transformers import (
    AlbertTokenizer,
    AutoTokenizer,
    BertTokenizer,
    BertTokenizerFast,
    GPTaTokenizerFast,
    is_tokenizers_available,
)
from transformers.testing_utils import TOKEN, USER, is_staging_test, require_tokenizers
from transformers.tokenization_utils import Trie


sys.path.append(str(Path(__file__).parent.parent / "utils"))

from test_module.custom_tokenization import CustomTokenizer  # noqa E402


if is_tokenizers_available():
					from test_module.custom_tokenization_fast import CustomTokenizerFast


class        lowercase      (	unittest.TestCase     ):



		def __UpperCamelCase				(				self )						->      Tuple:
				"""simple docstring"""
				# A mock response for an HTTP head request to emulate server down
				UpperCamelCase						=  mock.Mock()
				UpperCamelCase						=  500
				UpperCamelCase						=  {}
				UpperCamelCase						=  HTTPError
				UpperCamelCase						=  {}

				# Download this model to make sure it's in the cache.
				UpperCamelCase						=  BertTokenizer.from_pretrained('hf-internal-testing/tiny-random-bert' )

				# Under the mock environment we get a 500 error when trying to reach the tokenizer.
				with mock.patch('requests.Session.request'       ,   return_value=A_ ) as mock_head:
						UpperCamelCase						=  BertTokenizer.from_pretrained('hf-internal-testing/tiny-random-bert' )
						# This check we did call the fake head request
						mock_head.assert_called()



		@require_tokenizers
		def __UpperCamelCase				(				self )						->      Dict:
				"""simple docstring"""
				# A mock response for an HTTP head request to emulate server down
				UpperCamelCase						=  mock.Mock()
				UpperCamelCase						=  500
				UpperCamelCase						=  {}
				UpperCamelCase						=  HTTPError
				UpperCamelCase						=  {}

				# Download this model to make sure it's in the cache.
				UpperCamelCase						=  GPTaTokenizerFast.from_pretrained('gpt2' )

				# Under the mock environment we get a 500 error when trying to reach the tokenizer.
				with mock.patch('requests.Session.request'       ,   return_value=A_ ) as mock_head:
						UpperCamelCase						=  GPTaTokenizerFast.from_pretrained('gpt2' )
						# This check we did call the fake head request
						mock_head.assert_called()



		def __UpperCamelCase				(				self )						->      Optional[Any]:
				"""simple docstring"""
				# This test is for deprecated behavior and can be removed in v5
				try:
						UpperCamelCase						=  tempfile.mktemp()
						with open(A_       ,   'wb' ) as f:
								http_get('https://huggingface.co/albert-base-v1/resolve/main/spiece.model'       ,   A_ )

						UpperCamelCase						=  AlbertTokenizer.from_pretrained(A_ )
				finally:
						os.remove(A_ )

				# Supporting this legacy load introduced a weird bug where the tokenizer would load local files if they are in
				# the current folder and have the right name.
				if os.path.isfile('tokenizer.json' ):
						# We skip the test if the user has a `tokenizer.json` in this folder to avoid deleting it.
						return
				try:
						with open('tokenizer.json'       ,   'wb' ) as f:
								http_get('https://huggingface.co/hf-internal-testing/tiny-random-bert/blob/main/tokenizer.json'       ,   A_ )
						UpperCamelCase						=  AutoTokenizer.from_pretrained('hf-internal-testing/tiny-random-gpt2' )
						# The tiny random BERT has a vocab size of 1024, tiny gpt2 as a vocab size of 1000
						self.assertEqual(tokenizer.vocab_size       ,   1_000 )
						# Tokenizer should depend on the remote checkpoint, not the local tokenizer.json file.

				finally:
						os.remove('tokenizer.json' )



		def __UpperCamelCase				(				self )						->      Dict:
				"""simple docstring"""
				# This test is for deprecated behavior and can be removed in v5
				UpperCamelCase						=  AlbertTokenizer.from_pretrained('https://huggingface.co/albert-base-v1/resolve/main/spiece.model' )






@is_staging_test
class        lowercase      (	unittest.TestCase     ):
		__lowercase : int			  =       ["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]", "bla", "blou"]



		@classmethod
		def __UpperCamelCase				(				cls )						->      Tuple:
				"""simple docstring"""
				UpperCamelCase						=  TOKEN
				HfFolder.save_token(A_ )



		@classmethod
		def __UpperCamelCase				(				cls )						->      Optional[int]:
				"""simple docstring"""
				try:
						delete_repo(token=cls._token       ,   repo_id='test-tokenizer' )
				except HTTPError:
						pass

				try:
						delete_repo(token=cls._token       ,   repo_id='valid_org/test-tokenizer-org' )
				except HTTPError:
						pass

				try:
						delete_repo(token=cls._token       ,   repo_id='test-dynamic-tokenizer' )
				except HTTPError:
						pass



		def __UpperCamelCase				(				self )						->      Any:
				"""simple docstring"""
				with tempfile.TemporaryDirectory() as tmp_dir:
						UpperCamelCase						=  os.path.join(A_       ,   'vocab.txt' )
						with open(A_       ,   'w'       ,   encoding='utf-8' ) as vocab_writer:
								vocab_writer.write(''.join([x + '\n' for x in self.vocab_tokens] ) )
						UpperCamelCase						=  BertTokenizer(A_ )

				tokenizer.push_to_hub('test-tokenizer'       ,   use_auth_token=self._token )
				UpperCamelCase						=  BertTokenizer.from_pretrained(F'''{USER}/test-tokenizer''' )
				self.assertDictEqual(new_tokenizer.vocab       ,   tokenizer.vocab )

				# Reset repo
				delete_repo(token=self._token       ,   repo_id='test-tokenizer' )

				# Push to hub via save_pretrained
				with tempfile.TemporaryDirectory() as tmp_dir:
						tokenizer.save_pretrained(A_       ,   repo_id='test-tokenizer'       ,   push_to_hub=A_       ,   use_auth_token=self._token )

				UpperCamelCase						=  BertTokenizer.from_pretrained(F'''{USER}/test-tokenizer''' )
				self.assertDictEqual(new_tokenizer.vocab       ,   tokenizer.vocab )



		def __UpperCamelCase				(				self )						->      int:
				"""simple docstring"""
				with tempfile.TemporaryDirectory() as tmp_dir:
						UpperCamelCase						=  os.path.join(A_       ,   'vocab.txt' )
						with open(A_       ,   'w'       ,   encoding='utf-8' ) as vocab_writer:
								vocab_writer.write(''.join([x + '\n' for x in self.vocab_tokens] ) )
						UpperCamelCase						=  BertTokenizer(A_ )

				tokenizer.push_to_hub('valid_org/test-tokenizer-org'       ,   use_auth_token=self._token )
				UpperCamelCase						=  BertTokenizer.from_pretrained('valid_org/test-tokenizer-org' )
				self.assertDictEqual(new_tokenizer.vocab       ,   tokenizer.vocab )

				# Reset repo
				delete_repo(token=self._token       ,   repo_id='valid_org/test-tokenizer-org' )

				# Push to hub via save_pretrained
				with tempfile.TemporaryDirectory() as tmp_dir:
						tokenizer.save_pretrained(
						    A_       ,   repo_id='valid_org/test-tokenizer-org'       ,   push_to_hub=A_       ,   use_auth_token=self._token )

				UpperCamelCase						=  BertTokenizer.from_pretrained('valid_org/test-tokenizer-org' )
				self.assertDictEqual(new_tokenizer.vocab       ,   tokenizer.vocab )



		@require_tokenizers
		def __UpperCamelCase				(				self )						->      Dict:
				"""simple docstring"""
				CustomTokenizer.register_for_auto_class()
				with tempfile.TemporaryDirectory() as tmp_dir:
						UpperCamelCase						=  os.path.join(A_       ,   'vocab.txt' )
						with open(A_       ,   'w'       ,   encoding='utf-8' ) as vocab_writer:
								vocab_writer.write(''.join([x + '\n' for x in self.vocab_tokens] ) )
						UpperCamelCase						=  CustomTokenizer(A_ )

				# No fast custom tokenizer
				tokenizer.push_to_hub('test-dynamic-tokenizer'       ,   use_auth_token=self._token )

				UpperCamelCase						=  AutoTokenizer.from_pretrained(F'''{USER}/test-dynamic-tokenizer'''       ,   trust_remote_code=A_ )
				# Can't make an isinstance check because the new_model.config is from the CustomTokenizer class of a dynamic module
				self.assertEqual(tokenizer.__class__.__name__       ,   'CustomTokenizer' )

				# Fast and slow custom tokenizer
				CustomTokenizerFast.register_for_auto_class()
				with tempfile.TemporaryDirectory() as tmp_dir:
						UpperCamelCase						=  os.path.join(A_       ,   'vocab.txt' )
						with open(A_       ,   'w'       ,   encoding='utf-8' ) as vocab_writer:
								vocab_writer.write(''.join([x + '\n' for x in self.vocab_tokens] ) )

						UpperCamelCase						=  BertTokenizerFast.from_pretrained(A_ )
						bert_tokenizer.save_pretrained(A_ )
						UpperCamelCase						=  CustomTokenizerFast.from_pretrained(A_ )

				tokenizer.push_to_hub('test-dynamic-tokenizer'       ,   use_auth_token=self._token )

				UpperCamelCase						=  AutoTokenizer.from_pretrained(F'''{USER}/test-dynamic-tokenizer'''       ,   trust_remote_code=A_ )
				# Can't make an isinstance check because the new_model.config is from the FakeConfig class of a dynamic module
				self.assertEqual(tokenizer.__class__.__name__       ,   'CustomTokenizerFast' )
				UpperCamelCase						=  AutoTokenizer.from_pretrained(
				    F'''{USER}/test-dynamic-tokenizer'''       ,   use_fast=A_       ,   trust_remote_code=A_ )
				# Can't make an isinstance check because the new_model.config is from the FakeConfig class of a dynamic module
				self.assertEqual(tokenizer.__class__.__name__       ,   'CustomTokenizer' )






class        lowercase      (	unittest.TestCase     ):



		def __UpperCamelCase				(				self )						->      Optional[int]:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('Hello 友達' )
				self.assertEqual(trie.data       ,   {'H': {'e': {'l': {'l': {'o': {' ': {'友': {'達': {'': 1}}}}}}}}} )
				trie.add('Hello' )
				trie.data
				self.assertEqual(trie.data       ,   {'H': {'e': {'l': {'l': {'o': {'': 1, ' ': {'友': {'達': {'': 1}}}}}}}}} )



		def __UpperCamelCase				(				self )						->      str:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				self.assertEqual(trie.split('[CLS] This is a extra_id_100' )       ,   ['[CLS] This is a extra_id_100'] )
				trie.add('[CLS]' )
				trie.add('extra_id_1' )
				trie.add('extra_id_100' )
				self.assertEqual(trie.split('[CLS] This is a extra_id_100' )       ,   ['[CLS]', ' This is a ', 'extra_id_100'] )



		def __UpperCamelCase				(				self )						->      List[Any]:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('A' )
				self.assertEqual(trie.split('ABC' )       ,   ['A', 'BC'] )
				self.assertEqual(trie.split('BCA' )       ,   ['BC', 'A'] )



		def __UpperCamelCase				(				self )						->      Tuple:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('TOKEN]' )
				trie.add('[SPECIAL_TOKEN]' )
				self.assertEqual(trie.split('This is something [SPECIAL_TOKEN]' )       ,   ['This is something ', '[SPECIAL_TOKEN]'] )



		def __UpperCamelCase				(				self )						->      Dict:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('A' )
				trie.add('P' )
				trie.add('[SPECIAL_TOKEN]' )
				self.assertEqual(trie.split('This is something [SPECIAL_TOKEN]' )       ,   ['This is something ', '[SPECIAL_TOKEN]'] )



		def __UpperCamelCase				(				self )						->      Optional[Any]:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('AB' )
				trie.add('B' )
				trie.add('C' )
				self.assertEqual(trie.split('ABC' )       ,   ['AB', 'C'] )



		def __UpperCamelCase				(				self )						->      Tuple:
				"""simple docstring"""
				UpperCamelCase						=  Trie()
				trie.add('ABC' )
				trie.add('B' )
				trie.add('CD' )
				self.assertEqual(trie.split('ABCD' )       ,   ['ABC', 'D'] )



		def __UpperCamelCase				(				self )						->      int:
				"""simple docstring"""
				# Even if the offsets are wrong, we necessarily output correct string
				# parts.
				UpperCamelCase						=  Trie()
				UpperCamelCase						=  trie.cut_text('ABC'       ,   [0, 0, 2, 1, 2, 3] )
				self.assertEqual(A_       ,   ['AB', 'C'] )
