





from __future__ import annotations

import unittest

import numpy as np

from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
				import tensorflow as tf

				from transformers import GPTaTokenizer, TFOPTForCausalLM, TFOPTModel


def 					A__	(       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_=None							,       SCREAMING_SNAKE_CASE_=None		)   ->     int:


		if attention_mask is None:
				lowerCamelCase   : Optional[Any]								=tf.cast(tf.math.not_equal(SCREAMING_SNAKE_CASE_							,       config.pad_token_id		)							,       tf.inta		)
		return {"input_ids": input_ids, "attention_mask": attention_mask}
@require_tf
class        snake_case_		:
							lowerCamelCase    :Union[str, Any]						=     OPTConfig
							lowerCamelCase    :Optional[int]						=     {}
							lowerCamelCase    :List[Any]						=     "gelu"







							def __init__(		self			,     __lowercase			,     __lowercase=1_3			,     __lowercase=7			,     __lowercase=True			,     __lowercase=False			,     __lowercase=9_9			,     __lowercase=1_6			,     __lowercase=2			,     __lowercase=4			,     __lowercase=4			,     __lowercase="gelu"			,     __lowercase=0.1			,     __lowercase=0.1			,     __lowercase=2_0			,     __lowercase=2			,     __lowercase=1			,     __lowercase=0			,     __lowercase=1_6			,     __lowercase=1_6			,     )				->   Optional[int]:
									lowerCamelCase   : Dict								=parent
									lowerCamelCase   : Tuple								=batch_size
									lowerCamelCase   : List[str]								=seq_length
									lowerCamelCase   : List[Any]								=is_training
									lowerCamelCase   : Optional[Any]								=use_labels
									lowerCamelCase   : int								=vocab_size
									lowerCamelCase   : int								=hidden_size
									lowerCamelCase   : Dict								=num_hidden_layers
									lowerCamelCase   : Optional[int]								=num_attention_heads
									lowerCamelCase   : List[Any]								=intermediate_size
									lowerCamelCase   : List[str]								=hidden_act
									lowerCamelCase   : Any								=hidden_dropout_prob
									lowerCamelCase   : Tuple								=attention_probs_dropout_prob
									lowerCamelCase   : Any								=max_position_embeddings
									lowerCamelCase   : int								=eos_token_id
									lowerCamelCase   : int								=pad_token_id
									lowerCamelCase   : int								=bos_token_id
									lowerCamelCase   : Optional[Any]								=embed_dim
									lowerCamelCase   : Dict								=word_embed_proj_dim
									lowerCamelCase   : Tuple								=False







							def 			__lowercase   (		self   )				->   int:
									lowerCamelCase   : int								=ids_tensor([self.batch_size, self.seq_length - 1]			,     self.vocab_size   )
									lowerCamelCase   : List[str]								=tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size   )			,     1   )
									lowerCamelCase   : Optional[int]								=tf.concat([input_ids, eos_tensor]			,     axis=1   )

									lowerCamelCase   : Union[str, Any]								=self.config_cls(
									    vocab_size=self.vocab_size			,     hidden_size=self.hidden_size			,     num_hidden_layers=self.num_hidden_layers			,     num_attention_heads=self.num_attention_heads			,     ffn_dim=self.intermediate_size			,     dropout=self.hidden_dropout_prob			,     attention_dropout=self.attention_probs_dropout_prob			,     max_position_embeddings=self.max_position_embeddings			,     eos_token_id=self.eos_token_id			,     bos_token_id=self.bos_token_id			,     pad_token_id=self.pad_token_id			,     embed_dim=self.embed_dim			,     word_embed_proj_dim=self.word_embed_proj_dim			,     is_encoder_decoder=__lowercase			,     **self.config_updates			,     )
									lowerCamelCase   : Optional[int]								=prepare_opt_inputs_dict(__lowercase			,     __lowercase   )
									return config, inputs_dict







							def 			__lowercase   (		self			,     __lowercase			,     __lowercase   )				->   Optional[Any]:
									lowerCamelCase   : Dict								=TFOPTModel(config=__lowercase   )
									lowerCamelCase   : int								=inputs_dict['''input_ids''']

									lowerCamelCase   : int								=input_ids[:1, :]
									lowerCamelCase   : str								=inputs_dict['''attention_mask'''][:1, :]
									lowerCamelCase   : List[str]								=1

									# first forward pass
									lowerCamelCase   : Any								=model(__lowercase			,     attention_mask=__lowercase			,     use_cache=__lowercase   )

									lowerCamelCase		,   lowerCamelCase   : List[Any]								=outputs.to_tuple()

									# create hypothetical next token and extent to next_input_ids
									lowerCamelCase   : Union[str, Any]								=ids_tensor((self.batch_size, 3)			,     config.vocab_size   )
									lowerCamelCase   : str								=tf.cast(ids_tensor((self.batch_size, 3)			,     2   )			,     tf.inta   )

									# append to next input_ids and
									lowerCamelCase   : Any								=tf.concat([input_ids, next_tokens]			,     axis=-1   )
									lowerCamelCase   : Dict								=tf.concat([attention_mask, next_attn_mask]			,     axis=-1   )

									lowerCamelCase   : Any								=model(__lowercase			,     attention_mask=__lowercase   )[0]
									lowerCamelCase   : Optional[Any]								=model(__lowercase			,     attention_mask=__lowercase			,     past_key_values=__lowercase   )[0]

									self.parent.assertEqual(next_tokens.shape[1]			,     output_from_past.shape[1]   )

									# select random slice
									lowerCamelCase   : Optional[Any]								=int(ids_tensor((1,)			,     output_from_past.shape[-1]   )   )
									lowerCamelCase   : Union[str, Any]								=output_from_no_past[:, -3:, random_slice_idx]
									lowerCamelCase   : int								=output_from_past[:, :, random_slice_idx]

									# test that outputs are equal for slice
									tf.debugging.assert_near(__lowercase			,     __lowercase			,     rtol=1e-3   )

@require_tf
class        snake_case_		(			_A						,					_A						,					unittest.TestCase):
							lowerCamelCase    :Optional[Any]						=     (TFOPTModel, TFOPTForCausalLM) if is_tf_available() else ()
							lowerCamelCase    :str						=     (TFOPTForCausalLM,) if is_tf_available() else ()
							lowerCamelCase    :List[Any]						=     (
							    {"feature-extraction": TFOPTModel, "text-generation": TFOPTForCausalLM} if is_tf_available() else {}
							)
							lowerCamelCase    :Any						=     False
							lowerCamelCase    :List[str]						=     False
							lowerCamelCase    :Optional[int]						=     False
							lowerCamelCase    :List[Any]						=     10







							def 			__lowercase   (		self   )				->   Dict:
									lowerCamelCase   : Any								=TFOPTModelTester(self   )
									lowerCamelCase   : Any								=ConfigTester(self			,     config_class=__lowercase   )







							def 			__lowercase   (		self   )				->   Union[str, Any]:
									self.config_tester.run_common_tests()







							def 			__lowercase   (		self   )				->   Optional[int]:
									lowerCamelCase   : Any								=self.model_tester.prepare_config_and_inputs_for_common()
									self.model_tester.check_decoder_model_past_large_inputs(*__lowercase   )







							def 			__lowercase   (		self   )				->   Optional[Any]:
									lowerCamelCase		,   lowerCamelCase   : Tuple								=self.model_tester.prepare_config_and_inputs_for_common()

									def _get_word_embedding_weight(__lowercase			,     __lowercase   ):
											if hasattr(__lowercase			,     '''weight'''   ):
													return embedding_layer.weight
											else:
													# Here we build the word embeddings weights if not exists.
													# And then we retry to get the attribute once built.
													model.build()
													if hasattr(__lowercase			,     '''weight'''   ):
															return embedding_layer.weight
													else:
															return None

									for model_class in self.all_model_classes:
											for size in [config.vocab_size - 1_0, config.vocab_size + 1_0]:
													# build the embeddings
													lowerCamelCase   : str								=model_class(config=__lowercase   )
													lowerCamelCase   : str								=_get_word_embedding_weight(__lowercase			,     model.get_input_embeddings()   )
													lowerCamelCase   : Union[str, Any]								=_get_word_embedding_weight(__lowercase			,     model.get_output_embeddings()   )

													# reshape the embeddings
													model.resize_token_embeddings(__lowercase   )
													lowerCamelCase   : Dict								=_get_word_embedding_weight(__lowercase			,     model.get_input_embeddings()   )
													lowerCamelCase   : Dict								=_get_word_embedding_weight(__lowercase			,     model.get_output_embeddings()   )

													# check that the resized embeddings size matches the desired size.
													lowerCamelCase   : Dict								=size if size is not None else config.vocab_size

													self.assertEqual(new_input_embeddings.shape[0]			,     __lowercase   )

													# check that weights remain the same after resizing
													lowerCamelCase   : Optional[Any]								=True
													for pa, pa in zip(old_input_embeddings.value()			,     new_input_embeddings.value()   ):
															if tf.math.reduce_sum(tf.math.abs(pa - pa   )   ) > 0:
																	lowerCamelCase   : Union[str, Any]								=False
													self.assertTrue(__lowercase   )

													if old_output_embeddings is not None and new_output_embeddings is not None:
															self.assertEqual(new_output_embeddings.shape[0]			,     __lowercase   )

															lowerCamelCase   : Tuple								=True
															for pa, pa in zip(old_output_embeddings.value()			,     new_output_embeddings.value()   ):
																	if tf.math.reduce_sum(tf.math.abs(pa - pa   )   ) > 0:
																			lowerCamelCase   : Dict								=False
															self.assertTrue(__lowercase   )


def 					A__	(       SCREAMING_SNAKE_CASE_		)   ->     Optional[Any]:
		return tf.constant(SCREAMING_SNAKE_CASE_							,       dtype=tf.intaa		)
@require_tf
class        snake_case_		(			unittest.TestCase):
							lowerCamelCase    :Tuple						=     99







							def 			__lowercase   (		self   )				->   Optional[int]:
									lowerCamelCase   : Tuple								=tf.ones((4, 1)			,     dtype=tf.intaa   ) * 2
									lowerCamelCase   : List[str]								=tf.concat([ids_tensor((4, 6)			,     self.vocab_size - 3   ) + 3, eos_column_vector]			,     axis=1   )
									lowerCamelCase   : Optional[int]								=input_ids.shape[0]
									lowerCamelCase   : Tuple								=OPTConfig(
									    vocab_size=self.vocab_size			,     hidden_size=2_4			,     num_hidden_layers=2			,     num_attention_heads=2			,     ffn_dim=3_2			,     max_position_embeddings=4_8			,     eos_token_id=2			,     pad_token_id=1			,     bos_token_id=0			,     )
									return config, input_ids, batch_size

@require_sentencepiece
@require_tf
class        snake_case_		(			unittest.TestCase):







							@slow
							def 			__lowercase   (		self   )				->   str:
									lowerCamelCase   : str								=TFOPTModel.from_pretrained('''facebook/opt-350m'''   )
									lowerCamelCase   : Dict								=_long_tensor([[0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9, 4_6_0_7_8, 1_5_8_8, 2]]   )
									lowerCamelCase   : Union[str, Any]								=tf.not_equal(__lowercase			,     model.config.pad_token_id   )
									with tf.GradientTape():
											lowerCamelCase   : Dict								=model(input_ids=__lowercase			,     attention_mask=__lowercase   ).last_hidden_state
									lowerCamelCase   : Any								=(1, 1_1, 5_1_2)
									self.assertEqual(output.shape			,     __lowercase   )
									lowerCamelCase   : Union[str, Any]								=tf.constant(
									    [[-0.2_8_7_3, -1.9_2_1_8, -0.3_0_3_3], [-1.2_7_1_0, -0.1_3_3_8, -0.1_9_0_2], [0.4_0_9_5, 0.1_2_1_4, -1.3_1_2_1]]   )
									self.assertTrue(np.allclose(output[:, :3, :3]			,     __lowercase			,     atol=4e-3   )   )

									lowerCamelCase   : Dict								=tf.function(__lowercase			,     jit_compile=__lowercase   )
									lowerCamelCase   : Union[str, Any]								=xla_generate(__lowercase			,     __lowercase   )[0]
									self.assertTrue(np.allclose(output[:, :3, :3]			,     __lowercase			,     atol=4e-2   )   )

@require_tf
@slow
class        snake_case_		(			unittest.TestCase):







							def 			__lowercase   (		self   )				->   Any:
									super().setUp()
									lowerCamelCase   : List[Any]								='''facebook/opt-350m'''







							def 			__lowercase   (		self   )				->   Tuple:
									lowerCamelCase   : str								=TFOPTForCausalLM.from_pretrained(self.path_model   )
									lowerCamelCase   : List[Any]								=GPTaTokenizer.from_pretrained(self.path_model   )

									lowerCamelCase   : int								=[
									    '''Today is a beautiful day and I want to''',
									    '''In the city of''',
									    '''Paris is the capital of France and''',
									    '''Computers and mobile phones have taken''',
									]
									# verify that prompt without BOS token is identical to Metaseq -> add_special_tokens=False
									lowerCamelCase   : Tuple								=tokenizer(__lowercase			,     return_tensors='''tf'''			,     padding=__lowercase			,     add_special_tokens=__lowercase   )
									lowerCamelCase   : List[Any]								=tf.math.reduce_mean(model(inputs.input_ids			,     attention_mask=inputs.attention_mask   )[0]			,     axis=-1   )
									lowerCamelCase   : Optional[int]								=tf.constant(
									    [
									        [1.3_8_5_1, -1_3.8_9_2_3, -1_0.5_2_2_9, -1_0.7_5_3_3, -0.2_3_0_9, -1_0.2_3_8_4, -0.5_3_6_5, -9.0_9_4_7, -5.1_6_7_0],
									        [-4.7_0_7_3, -1_0.6_2_7_6, -3.9_4_1_5, -2_1.5_2_4_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2, -0.2_8_2_2],
									        [0.6_2_4_7, -3.4_2_2_9, -8.9_1_7_9, -1.4_2_9_7, -1_4.1_6_5_0, 1.4_1_4_6, -9.0_2_1_8, -0.2_7_0_3, -0.2_7_0_3],
									        [6.4_7_8_3, -1.9_9_1_3, -1_0.7_9_2_6, -2.3_3_3_6, 1.5_0_9_2, -0.9_9_7_4, -6.8_2_1_3, 1.3_4_7_7, 1.3_4_7_7],
									    ]   )
									self.assertTrue(np.allclose(__lowercase			,     __lowercase			,     atol=1e-4   )   )

									lowerCamelCase   : List[str]								=tf.function(__lowercase			,     jit_compile=__lowercase   )
									lowerCamelCase   : Dict								=tf.math.reduce_mean(xla_generate(inputs.input_ids			,     attention_mask=inputs.attention_mask   )[0]			,     axis=-1   )
									self.assertTrue(np.allclose(__lowercase			,     __lowercase			,     atol=1e-4   )   )

@require_tf
@slow
class        snake_case_		(			unittest.TestCase):







							@property
							def 			__lowercase   (		self   )				->   str:
									return [
									    "Today is a beautiful day and I want",
									    "In the city of",
									    "Paris is the capital of France and",
									    "Computers and mobile phones have taken",
									]







							def 			__lowercase   (		self   )				->   Optional[Any]:
									lowerCamelCase   : Optional[int]								='''facebook/opt-125m'''

									lowerCamelCase   : str								=[
									    '''Today is a beautiful day and I want to''',
									    '''In the city of New York, the city''',
									    '''Paris is the capital of France and the capital''',
									    '''Computers and mobile phones have taken over the''',
									]

									lowerCamelCase   : Union[str, Any]								=[]
									lowerCamelCase   : str								=GPTaTokenizer.from_pretrained(__lowercase   )
									lowerCamelCase   : Optional[int]								=TFOPTForCausalLM.from_pretrained(__lowercase   )

									for prompt in self.prompts:
											lowerCamelCase   : Dict								=tokenizer(__lowercase			,     return_tensors='''tf'''   ).input_ids

											lowerCamelCase   : List[Any]								=model.generate(__lowercase			,     max_length=1_0   )

											lowerCamelCase   : Union[str, Any]								=tokenizer.batch_decode(__lowercase			,     skip_special_tokens=__lowercase   )
											predicted_outputs += generated_string

									self.assertListEqual(__lowercase			,     __lowercase   )







							def 			__lowercase   (		self   )				->   Tuple:
									lowerCamelCase   : int								='''facebook/opt-350m'''

									lowerCamelCase   : Tuple								=GPTaTokenizer.from_pretrained(__lowercase   )
									lowerCamelCase   : Optional[Any]								=TFOPTForCausalLM.from_pretrained(__lowercase   )

									lowerCamelCase   : Union[str, Any]								='''left'''

									# use different length sentences to test batching
									lowerCamelCase   : Dict								=[
									    '''Hello, my dog is a little''',
									    '''Today, I''',
									]

									lowerCamelCase   : Optional[Any]								=tokenizer(__lowercase			,     return_tensors='''tf'''			,     padding=__lowercase   )
									lowerCamelCase   : int								=inputs['''input_ids''']

									lowerCamelCase   : int								=model.generate(input_ids=__lowercase			,     attention_mask=inputs['''attention_mask''']   )

									lowerCamelCase   : Optional[Any]								=tokenizer(sentences[0]			,     return_tensors='''tf'''   ).input_ids
									lowerCamelCase   : List[Any]								=model.generate(input_ids=__lowercase   )

									lowerCamelCase   : Tuple								=inputs_non_padded.shape[-1] - tf.math.reduce_sum(
									    tf.cast(inputs['''attention_mask'''][-1]			,     tf.intaa   )   )
									lowerCamelCase   : Tuple								=tokenizer(sentences[1]			,     return_tensors='''tf'''   ).input_ids
									lowerCamelCase   : List[Any]								=model.generate(input_ids=__lowercase			,     max_length=model.config.max_length - num_paddings   )

									lowerCamelCase   : List[str]								=tokenizer.batch_decode(__lowercase			,     skip_special_tokens=__lowercase   )
									lowerCamelCase   : int								=tokenizer.decode(output_non_padded[0]			,     skip_special_tokens=__lowercase   )
									lowerCamelCase   : Dict								=tokenizer.decode(output_padded[0]			,     skip_special_tokens=__lowercase   )

									lowerCamelCase   : Optional[Any]								=[
									    '''Hello, my dog is a little bit of a dork.\nI\'m a little bit''',
									    '''Today, I was in the middle of a conversation with a friend about the''',
									]
									self.assertListEqual(__lowercase			,     __lowercase   )
									self.assertListEqual(__lowercase			,     [non_padded_sentence, padded_sentence]   )







							def 			__lowercase   (		self   )				->   Tuple:
									lowerCamelCase   : Dict								='''facebook/opt-350m'''

									lowerCamelCase   : Optional[int]								=[
									    '''Today is a beautiful day and I want to''',
									    '''In the city of San Francisco, the city''',
									    '''Paris is the capital of France and the capital''',
									    '''Computers and mobile phones have taken over the''',
									]

									lowerCamelCase   : str								=[]
									lowerCamelCase   : Tuple								=GPTaTokenizer.from_pretrained(__lowercase   )
									lowerCamelCase   : Optional[int]								=TFOPTForCausalLM.from_pretrained(__lowercase   )

									for prompt in self.prompts:
											lowerCamelCase   : Union[str, Any]								=tokenizer(__lowercase			,     return_tensors='''tf'''   ).input_ids

											lowerCamelCase   : Dict								=model.generate(__lowercase			,     max_length=1_0   )

											lowerCamelCase   : Dict								=tokenizer.batch_decode(__lowercase			,     skip_special_tokens=__lowercase   )
											predicted_outputs += generated_string

									self.assertListEqual(__lowercase			,     __lowercase   )








def 					A__	(       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_ = False		)   ->     bool:
		if n == 2:
				return True
		if not n % 2 or n < 2:
				return False
		if n > 5 and n % 1_0 not in (1, 3, 7, 9):  # can quickly check last digit
				return False
		if n > 3_3_1_7_0_4_4_0_6_4_6_7_9_8_8_7_3_8_5_9_6_1_9_8_1 and not allow_probable:
				raise ValueError(
				    '''Warning: upper bound of deterministic test is exceeded. '''
				    '''Pass allow_probable=True to allow probabilistic test. '''
				    '''A return value of True indicates a probable prime.'''		)
		# array bounds provided by analysis
		lowerCamelCase   : Optional[Any]								=[
		    2_0_4_7,
		    1_3_7_3_6_5_3,
		    2_5_3_2_6_0_0_1,
		    3_2_1_5_0_3_1_7_5_1,
		    2_1_5_2_3_0_2_8_9_8_7_4_7,
		    3_4_7_4_7_4_9_6_6_0_3_8_3,
		    3_4_1_5_5_0_0_7_1_7_2_8_3_2_1,
		    1,
		    3_8_2_5_1_2_3_0_5_6_5_4_6_4_1_3_0_5_1,
		    1,
		    1,
		    3_1_8_6_6_5_8_5_7_8_3_4_0_3_1_1_5_1_1_6_7_4_6_1,
		    3_3_1_7_0_4_4_0_6_4_6_7_9_8_8_7_3_8_5_9_6_1_9_8_1,
		]

		lowerCamelCase   : Dict								=[2, 3, 5, 7, 1_1, 1_3, 1_7, 1_9, 2_3, 2_9, 3_1, 3_7, 4_1]
		for idx, _p in enumerate(SCREAMING_SNAKE_CASE_							,       1		):
				if n < _p:
						# then we have our last prime to check
						lowerCamelCase   : Any								=primes[:idx]
						break
		lowerCamelCase		,   lowerCamelCase   : Any								=n - 1, 0
		# break up n -1 into a power of 2 (s) and
		# remaining odd component
		# essentially, solve for d * 2 ** s == n - 1
		while d % 2 == 0:
				d //= 2
				s += 1
		for prime in plist:
				lowerCamelCase   : Union[str, Any]								=False
				for r in range(SCREAMING_SNAKE_CASE_		):
						lowerCamelCase   : List[str]								=pow(SCREAMING_SNAKE_CASE_							,       d * 2**r							,       SCREAMING_SNAKE_CASE_		)
						# see article for analysis explanation for m
						if (r == 0 and m == 1) or ((m + 1) % n == 0):
								lowerCamelCase   : List[str]								=True
								# this loop will not determine compositeness
								break
				if pr:
						continue
				# if pr is False, then the above loop never evaluated to true,
				# and the n MUST be composite
				return False
		return True


def 					A__	(       )   ->     None:
		assert not miller_rabin(5_6_1		)
		assert miller_rabin(5_6_3		)
		# 2047

		assert not miller_rabin(8_3_8_2_0_1		)
		assert miller_rabin(8_3_8_2_0_7		)
		# 1_373_653

		assert not miller_rabin(1_7_3_1_6_0_0_1		)
		assert miller_rabin(1_7_3_1_6_0_1_7		)
		# 25_326_001

		assert not miller_rabin(3_0_7_8_3_8_6_6_4_1		)
		assert miller_rabin(3_0_7_8_3_8_6_6_5_3		)
		# 3_215_031_751

		assert not miller_rabin(1_7_1_3_0_4_5_5_7_4_8_0_1		)
		assert miller_rabin(1_7_1_3_0_4_5_5_7_4_8_1_9		)
		# 2_152_302_898_747

		assert not miller_rabin(2_7_7_9_7_9_9_7_2_8_3_0_7		)
		assert miller_rabin(2_7_7_9_7_9_9_7_2_8_3_2_7		)
		# 3_474_749_660_383

		assert not miller_rabin(1_1_3_8_5_0_0_2_3_9_0_9_4_4_1		)
		assert miller_rabin(1_1_3_8_5_0_0_2_3_9_0_9_5_2_7		)
		# 341_550_071_728_321

		assert not miller_rabin(1_2_7_5_0_4_1_0_1_8_8_4_8_8_0_4_3_5_1		)
		assert miller_rabin(1_2_7_5_0_4_1_0_1_8_8_4_8_8_0_4_3_9_1		)
		# 3_825_123_056_546_413_051

		assert not miller_rabin(7_9_6_6_6_4_6_4_4_5_8_5_0_7_7_8_7_7_9_1_8_6_7		)
		assert miller_rabin(7_9_6_6_6_4_6_4_4_5_8_5_0_7_7_8_7_7_9_1_9_5_1		)
		# 318_665_857_834_031_151_167_461

		assert not miller_rabin(5_5_2_8_4_0_6_7_7_4_4_6_6_4_7_8_9_7_6_6_0_3_3_3		)
		assert miller_rabin(5_5_2_8_4_0_6_7_7_4_4_6_6_4_7_8_9_7_6_6_0_3_5_9		)
		# 3_317_044_064_679_887_385_961_981
		# upper limit for probabilistic test


if __name__ == "__main__":
				test_miller_rabin()

