



import math
import os
import unittest

from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, 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 (
			    MODEL_FOR_PRETRAINING_MAPPING,
			    MegatronBertForCausalLM,
			    MegatronBertForMaskedLM,
			    MegatronBertForMultipleChoice,
			    MegatronBertForNextSentencePrediction,
			    MegatronBertForPreTraining,
			    MegatronBertForQuestionAnswering,
			    MegatronBertForSequenceClassification,
			    MegatronBertForTokenClassification,
			    MegatronBertModel,
			)


class 						lowercase    :
						'''simple docstring'''


						def __init__(  self    :				List[Any]       ,	snake_case    :				List[str]       ,	snake_case    :				Optional[int]=13       ,	snake_case    :				Tuple=7       ,	snake_case    :				int=True       ,	snake_case    :				Optional[Any]=True       ,	snake_case    :				Dict=True       ,	snake_case    :				Tuple=True       ,	snake_case    :				List[Any]=99       ,	snake_case    :				Dict=64       ,	snake_case    :				int=32       ,	snake_case    :				List[str]=5       ,	snake_case    :				str=4       ,	snake_case    :				Tuple=37       ,	snake_case    :				Any="gelu"       ,	snake_case    :				Tuple=0.1       ,	snake_case    :				Optional[Any]=0.1       ,	snake_case    :				List[str]=512       ,	snake_case    :				Union[str, Any]=16       ,	snake_case    :				Any=2       ,	snake_case    :				Tuple=0.02       ,	snake_case    :				Any=3       ,	snake_case    :				Tuple=4       ,	snake_case    :				Optional[Any]=None       ,	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				parent
											SCREAMING_SNAKE_CASE							:     Tuple						=				batch_size
											SCREAMING_SNAKE_CASE							:     Dict						=				seq_length
											SCREAMING_SNAKE_CASE							:     Any						=				is_training
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				use_input_mask
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				use_token_type_ids
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				use_labels
											SCREAMING_SNAKE_CASE							:     int						=				vocab_size
											SCREAMING_SNAKE_CASE							:     Any						=				hidden_size
											SCREAMING_SNAKE_CASE							:     str						=				embedding_size
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				num_hidden_layers
											SCREAMING_SNAKE_CASE							:     int						=				num_attention_heads
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				intermediate_size
											SCREAMING_SNAKE_CASE							:     List[str]						=				hidden_act
											SCREAMING_SNAKE_CASE							:     Dict						=				hidden_dropout_prob
											SCREAMING_SNAKE_CASE							:     List[str]						=				attention_probs_dropout_prob
											SCREAMING_SNAKE_CASE							:     int						=				max_position_embeddings
											SCREAMING_SNAKE_CASE							:     Dict						=				type_vocab_size
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				type_sequence_label_size
											SCREAMING_SNAKE_CASE							:     Any						=				initializer_range
											SCREAMING_SNAKE_CASE							:     int						=				num_labels
											SCREAMING_SNAKE_CASE							:     int						=				num_choices
											SCREAMING_SNAKE_CASE							:     str						=				scope







						def       lowerCamelCase_				(  self    :				Union[str, Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				ids_tensor([self.batch_size, self.seq_length]       ,	self.vocab_size	)

											SCREAMING_SNAKE_CASE							:     Tuple						=				None
											if self.use_input_mask:
																SCREAMING_SNAKE_CASE							:     Dict						=				random_attention_mask([self.batch_size, self.seq_length]	)

											SCREAMING_SNAKE_CASE							:     int						=				None
											if self.use_token_type_ids:
																SCREAMING_SNAKE_CASE							:     List[str]						=				ids_tensor([self.batch_size, self.seq_length]       ,	self.type_vocab_size	)

											SCREAMING_SNAKE_CASE							:     int						=				None
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				None
											SCREAMING_SNAKE_CASE							:     Any						=				None
											if self.use_labels:
																SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				ids_tensor([self.batch_size]       ,	self.type_sequence_label_size	)
																SCREAMING_SNAKE_CASE							:     List[Any]						=				ids_tensor([self.batch_size, self.seq_length]       ,	self.num_labels	)
																SCREAMING_SNAKE_CASE							:     int						=				ids_tensor([self.batch_size]       ,	self.num_choices	)

											SCREAMING_SNAKE_CASE							:     Tuple						=				self.get_config()

											return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels







						def       lowerCamelCase_				(  self    :				Union[str, Any]	):



											'''simple docstring'''


											return MegatronBertConfig(
											    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_size=self.intermediate_size       ,	embedding_size=self.embedding_size       ,	hidden_act=self.hidden_act       ,	hidden_dropout_prob=self.hidden_dropout_prob       ,	attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,	max_position_embeddings=self.max_position_embeddings       ,	type_vocab_size=self.type_vocab_size       ,	is_decoder=snake_case       ,	initializer_range=self.initializer_range       ,	)







						def       lowerCamelCase_				(  self    :				Dict       ,	snake_case    :				int       ,	snake_case    :				str       ,	snake_case    :				int       ,	snake_case    :				Optional[Any]       ,	snake_case    :				List[Any]       ,	snake_case    :				int       ,	snake_case    :				List[str]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				MegatronBertModel(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     List[Any]						=				model(snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case	)
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				model(snake_case       ,	token_type_ids=snake_case	)
											SCREAMING_SNAKE_CASE							:     Tuple						=				model(snake_case	)

											self.parent.assertEqual(result.last_hidden_state.shape       ,	(self.batch_size, self.seq_length, self.hidden_size)	)
											self.parent.assertEqual(result.pooler_output.shape       ,	(self.batch_size, self.hidden_size)	)







						def       lowerCamelCase_				(  self    :				Dict       ,	snake_case    :				Tuple       ,	snake_case    :				Any       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Dict       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				List[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[int]						=				MegatronBertForMaskedLM(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     str						=				model(snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length, self.vocab_size)	)







						def       lowerCamelCase_				(  self    :				Tuple       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Optional[int]       ,	snake_case    :				List[str]       ,	snake_case    :				Tuple       ,	snake_case    :				str       ,	snake_case    :				List[Any]       ,	snake_case    :				List[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     int						=				MegatronBertForCausalLM(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     int						=				model(snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length, self.vocab_size)	)







						def       lowerCamelCase_				(  self    :				List[Any]       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Any       ,	snake_case    :				Any       ,	snake_case    :				List[str]       ,	snake_case    :				Any       ,	snake_case    :				Optional[int]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Tuple						=				MegatronBertForNextSentencePrediction(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     Dict						=				model(
											    snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case       ,	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, 2)	)







						def       lowerCamelCase_				(  self    :				Optional[Any]       ,	snake_case    :				int       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Any       ,	snake_case    :				Dict       ,	snake_case    :				Tuple       ,	snake_case    :				Optional[int]       ,	snake_case    :				List[str]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				MegatronBertForPreTraining(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     Dict						=				model(
											    snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case       ,	next_sentence_label=snake_case       ,	)
											self.parent.assertEqual(result.prediction_logits.shape       ,	(self.batch_size, self.seq_length, self.vocab_size)	)
											self.parent.assertEqual(result.seq_relationship_logits.shape       ,	(self.batch_size, 2)	)







						def       lowerCamelCase_				(  self    :				Optional[Any]       ,	snake_case    :				Optional[int]       ,	snake_case    :				Tuple       ,	snake_case    :				List[str]       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				Optional[Any]       ,	snake_case    :				int       ,	snake_case    :				Dict	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				MegatronBertForQuestionAnswering(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     int						=				model(
											    snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	start_positions=snake_case       ,	end_positions=snake_case       ,	)
											self.parent.assertEqual(result.start_logits.shape       ,	(self.batch_size, self.seq_length)	)
											self.parent.assertEqual(result.end_logits.shape       ,	(self.batch_size, self.seq_length)	)







						def       lowerCamelCase_				(  self    :				List[Any]       ,	snake_case    :				Optional[Any]       ,	snake_case    :				Tuple       ,	snake_case    :				Any       ,	snake_case    :				int       ,	snake_case    :				Tuple       ,	snake_case    :				List[Any]       ,	snake_case    :				Tuple	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[int]						=				self.num_labels
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				MegatronBertForSequenceClassification(snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				model(snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.num_labels)	)







						def       lowerCamelCase_				(  self    :				str       ,	snake_case    :				Tuple       ,	snake_case    :				List[str]       ,	snake_case    :				str       ,	snake_case    :				Tuple       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				List[str]       ,	snake_case    :				str	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				self.num_labels
											SCREAMING_SNAKE_CASE							:     Any						=				MegatronBertForTokenClassification(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     Dict						=				model(snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.seq_length, self.num_labels)	)







						def       lowerCamelCase_				(  self    :				Any       ,	snake_case    :				List[str]       ,	snake_case    :				List[Any]       ,	snake_case    :				Union[str, Any]       ,	snake_case    :				List[str]       ,	snake_case    :				int       ,	snake_case    :				Tuple       ,	snake_case    :				List[str]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     str						=				self.num_choices
											SCREAMING_SNAKE_CASE							:     Dict						=				MegatronBertForMultipleChoice(config=snake_case	)
											model.to(snake_case	)
											model.eval()
											SCREAMING_SNAKE_CASE							:     Dict						=				input_ids.unsqueeze(1	).expand(-1       ,	self.num_choices       ,	-1	).contiguous()
											SCREAMING_SNAKE_CASE							:     Dict						=				token_type_ids.unsqueeze(1	).expand(-1       ,	self.num_choices       ,	-1	).contiguous()
											SCREAMING_SNAKE_CASE							:     List[str]						=				input_mask.unsqueeze(1	).expand(-1       ,	self.num_choices       ,	-1	).contiguous()
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				model(
											    snake_case       ,	attention_mask=snake_case       ,	token_type_ids=snake_case       ,	labels=snake_case       ,	)
											self.parent.assertEqual(result.logits.shape       ,	(self.batch_size, self.num_choices)	)







						def       lowerCamelCase_				(  self    :				Optional[Any]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     List[str]						=				self.prepare_config_and_inputs()
											(
											    (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  (
											    SCREAMING_SNAKE_CASE
											)					,  
											)							:     Optional[Any]						=				config_and_inputs
											SCREAMING_SNAKE_CASE							:     Any						=				{'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
											return config, inputs_dict


@require_torch
class 						lowercase    (							SCREAMING_SNAKE_CASE_      ,    SCREAMING_SNAKE_CASE_      ,    unittest.TestCase):
						'''simple docstring'''


						UpperCAmelCase			:		Any		=		(
						    (
						        MegatronBertModel,
						        MegatronBertForMaskedLM,
						        MegatronBertForCausalLM,
						        MegatronBertForMultipleChoice,
						        MegatronBertForNextSentencePrediction,
						        MegatronBertForPreTraining,
						        MegatronBertForQuestionAnswering,
						        MegatronBertForSequenceClassification,
						        MegatronBertForTokenClassification,
						    )
						    if is_torch_available()
						    else ()
						)
						UpperCAmelCase			:		Tuple		=		(
						    {
						        'feature-extraction': MegatronBertModel,
						        'fill-mask': MegatronBertForMaskedLM,
						        'question-answering': MegatronBertForQuestionAnswering,
						        'text-classification': MegatronBertForSequenceClassification,
						        'text-generation': MegatronBertForCausalLM,
						        'token-classification': MegatronBertForTokenClassification,
						        'zero-shot': MegatronBertForSequenceClassification,
						    }
						    if is_torch_available()
						    else {}
						)
						UpperCAmelCase			:		Tuple		=		True
						# test_resize_embeddings = False
						UpperCAmelCase			:		Any		=		False







						def       lowerCamelCase_				(  self    :				str       ,	snake_case    :				Optional[int]       ,	snake_case    :				Dict       ,	snake_case    :				int=False	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				super()._prepare_for_class(snake_case       ,	snake_case       ,	return_labels=snake_case	)

											if return_labels:
																if model_class in get_values(snake_case	):
																					SCREAMING_SNAKE_CASE							:     Optional[int]						=				torch.zeros(
																					    (self.model_tester.batch_size, self.model_tester.seq_length)       ,	dtype=torch.long       ,	device=snake_case	)
																					SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				torch.zeros(
																					    self.model_tester.batch_size       ,	dtype=torch.long       ,	device=snake_case	)
											return inputs_dict







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				MegatronBertModelTester(self	)
											SCREAMING_SNAKE_CASE							:     Optional[int]						=				ConfigTester(self       ,	config_class=snake_case       ,	hidden_size=37	)







						def       lowerCamelCase_				(  self    :				Dict	):



											'''simple docstring'''


											self.config_tester.run_common_tests()







						def       lowerCamelCase_				(  self    :				Optional[int]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     List[Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_model(*snake_case	)







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     List[str]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_masked_lm(*snake_case	)







						def       lowerCamelCase_				(  self    :				Dict	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[int]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*snake_case	)







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*snake_case	)







						def       lowerCamelCase_				(  self    :				Dict	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_pretraining(*snake_case	)







						def       lowerCamelCase_				(  self    :				Any	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Any						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_question_answering(*snake_case	)







						def       lowerCamelCase_				(  self    :				List[str]	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*snake_case	)







						def       lowerCamelCase_				(  self    :				int	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_megatron_bert_for_token_classification(*snake_case	)


def        __a			(   __lowerCAmelCase   )     ->     Dict:
					return torch.tensor(
					    __lowerCAmelCase      ,	dtype=torch.long      ,	device=__lowerCAmelCase      ,	)


_lowerCamelCase    :		Union[str, Any]		      =    1e-4



@require_torch
@require_sentencepiece
@require_tokenizers
class 						lowercase    (							unittest.TestCase):
						'''simple docstring'''


						@slow
						@unittest.skip('Model is not available.'	)
						def       lowerCamelCase_				(  self    :				Tuple	):



											'''simple docstring'''


											SCREAMING_SNAKE_CASE							:     Dict						=				'nvidia/megatron-bert-uncased-345m'
											if "MYDIR" in os.environ:
																SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				os.path.join(os.environ['MYDIR']       ,	snake_case	)
											SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				MegatronBertModel.from_pretrained(snake_case	)
											model.to(snake_case	)
											model.half()
											SCREAMING_SNAKE_CASE							:     Optional[Any]						=				_long_tensor([[101, 7110, 1005, 1056, 2023, 11333, 17413, 1029, 102]]	)
											with torch.no_grad():
																SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				model(snake_case	)[0]
											SCREAMING_SNAKE_CASE							:     List[str]						=				torch.Size((1, 9, 1024)	)
											self.assertEqual(output.shape       ,	snake_case	)

											SCREAMING_SNAKE_CASE							:     int						=				[-0.6040, -0.2517, -0.1025, 0.3420, -0.6758, -0.0017, -0.1089, -0.1990, 0.5728]
											for ii in range(3	):
																for jj in range(3	):
																					SCREAMING_SNAKE_CASE							:     Tuple						=				output[0, ii, jj]
																					SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				expected[3 * ii + jj]
																					SCREAMING_SNAKE_CASE							:     Optional[int]						=				'ii={} jj={} a={} b={}'.format(snake_case       ,	snake_case       ,	snake_case       ,	snake_case	)
																					self.assertTrue(math.isclose(snake_case       ,	snake_case       ,	rel_tol=snake_case       ,	abs_tol=snake_case	)       ,	msg=snake_case	)




_lowerCamelCase    :		Optional[Any]		      =    256
# Modulus to hash a string
_lowerCamelCase    :		Optional[Any]		      =    1_000_003

def        __a			(   __lowerCAmelCase      ,	__lowerCAmelCase   )     ->     bool:
					SCREAMING_SNAKE_CASE							:     Tuple						=				len(__lowerCAmelCase   )
					SCREAMING_SNAKE_CASE							:     Tuple						=				len(__lowerCAmelCase   )
					if p_len > t_len:
										return False

					SCREAMING_SNAKE_CASE							:     Dict						=				0
					SCREAMING_SNAKE_CASE							:     Tuple						=				0
					SCREAMING_SNAKE_CASE							:     Optional[Any]						=				1

					# Calculating the hash of pattern and substring of text
					for i in range(__lowerCAmelCase   ):
										SCREAMING_SNAKE_CASE							:     Tuple						=				(ord(pattern[i]   ) + p_hash * alphabet_size) % modulus
										SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				(ord(text[i]   ) + text_hash * alphabet_size) % modulus
										if i == p_len - 1:
															continue
										SCREAMING_SNAKE_CASE							:     Optional[Any]						=				(modulus_power * alphabet_size) % modulus

					for i in range(0      ,	t_len - p_len + 1   ):
										if text_hash == p_hash and text[i : i + p_len] == pattern:
															return True
										if i == t_len - p_len:
															continue
										# Calculate the https://en.wikipedia.org/wiki/Rolling_hash
										SCREAMING_SNAKE_CASE							:     int						=				(
										    (text_hash - ord(text[i]   ) * modulus_power) * alphabet_size
										    + ord(text[i + p_len]   )
										) % modulus
					return False

def        __a			(   )     ->     None:
					SCREAMING_SNAKE_CASE							:     Any						=				'abc1abc12'
					SCREAMING_SNAKE_CASE							:     str						=				'alskfjaldsabc1abc1abc12k23adsfabcabc'
					SCREAMING_SNAKE_CASE							:     List[str]						=				'alskfjaldsk23adsfabcabc'
					assert rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   ) and not rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )

					# Test 2)
					SCREAMING_SNAKE_CASE							:     List[str]						=				'ABABX'
					SCREAMING_SNAKE_CASE							:     int						=				'ABABZABABYABABX'
					assert rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )

					# Test 3)
					SCREAMING_SNAKE_CASE							:     int						=				'AAAB'
					SCREAMING_SNAKE_CASE							:     Tuple						=				'ABAAAAAB'
					assert rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )

					# Test 4)
					SCREAMING_SNAKE_CASE							:     Tuple						=				'abcdabcy'
					SCREAMING_SNAKE_CASE							:     Optional[Any]						=				'abcxabcdabxabcdabcdabcy'
					assert rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )

					# Test 5)
					SCREAMING_SNAKE_CASE							:     List[Any]						=				'Lü'
					SCREAMING_SNAKE_CASE							:     Optional[Any]						=				'Lüsai'
					assert rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )
					SCREAMING_SNAKE_CASE							:     Union[str, Any]						=				'Lue'
					assert not rabin_karp(__lowerCAmelCase      ,	__lowerCAmelCase   )
					print('Success.'   )


if __name__ == "__main__":
			test_rabin_karp()