


"""simple docstring"""





import unittest

from transformers import ElectraConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

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


if is_torch_available():
 import torch

 from transformers import (
     MODEL_FOR_PRETRAINING_MAPPING,
     ElectraForCausalLM,
     ElectraForMaskedLM,
     ElectraForMultipleChoice,
     ElectraForPreTraining,
     ElectraForQuestionAnswering,
     ElectraForSequenceClassification,
     ElectraForTokenClassification,
     ElectraModel,
 )
 from transformers.models.electra.modeling_electra import ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST



class 		snake_case_:






     def __init__(						self	:       Tuple       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       str=1_3       ,					UpperCamelCase_	:       Tuple=7       ,					UpperCamelCase_	:       Union[str, Any]=True       ,					UpperCamelCase_	:       Tuple=True       ,					UpperCamelCase_	:       List[str]=True       ,					UpperCamelCase_	:       Tuple=True       ,					UpperCamelCase_	:       str=9_9       ,					UpperCamelCase_	:       Any=3_2       ,					UpperCamelCase_	:       int=5       ,					UpperCamelCase_	:       Optional[int]=4       ,					UpperCamelCase_	:       Tuple=3_7       ,					UpperCamelCase_	:       List[str]="gelu"       ,					UpperCamelCase_	:       Dict=0.1       ,					UpperCamelCase_	:       int=0.1       ,					UpperCamelCase_	:       Union[str, Any]=5_1_2       ,					UpperCamelCase_	:       Union[str, Any]=1_6       ,					UpperCamelCase_	:       int=2       ,					UpperCamelCase_	:       Dict=0.02       ,					UpperCamelCase_	:       Union[str, Any]=3       ,					UpperCamelCase_	:       List[str]=4       ,					UpperCamelCase_	:       Union[str, Any]=None       ,					):
           lowerCAmelCase       :						Tuple							= parent
           lowerCAmelCase       :						str							= batch_size
           lowerCAmelCase       :						Dict							= seq_length
           lowerCAmelCase       :						Union[str, Any]							= is_training
           lowerCAmelCase       :						Dict							= use_input_mask
           lowerCAmelCase       :						Optional[Any]							= use_token_type_ids
           lowerCAmelCase       :						Dict							= use_labels
           lowerCAmelCase       :						List[Any]							= vocab_size
           lowerCAmelCase       :						Dict							= hidden_size
           lowerCAmelCase       :						Dict							= num_hidden_layers
           lowerCAmelCase       :						Optional[Any]							= num_attention_heads
           lowerCAmelCase       :						Tuple							= intermediate_size
           lowerCAmelCase       :						Optional[Any]							= hidden_act
           lowerCAmelCase       :						str							= hidden_dropout_prob
           lowerCAmelCase       :						Any							= attention_probs_dropout_prob
           lowerCAmelCase       :						Tuple							= max_position_embeddings
           lowerCAmelCase       :						int							= type_vocab_size
           lowerCAmelCase       :						str							= type_sequence_label_size
           lowerCAmelCase       :						List[str]							= initializer_range
           lowerCAmelCase       :						List[str]							= num_labels
           lowerCAmelCase       :						List[str]							= num_choices
           lowerCAmelCase       :						List[str]							= scope






     def   lowerCamelCase__  (						self	:       Optional[Any]					):
           lowerCAmelCase       :						Dict							= ids_tensor([self.batch_size, self.seq_length]       ,					self.vocab_size					)

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

           lowerCAmelCase       :						List[Any]							= None
           if self.use_token_type_ids:
                 lowerCAmelCase       :						Optional[int]							= ids_tensor([self.batch_size, self.seq_length]       ,					self.type_vocab_size					)

           lowerCAmelCase       :						List[Any]							= None
           lowerCAmelCase       :						List[str]							= None
           lowerCAmelCase       :						Dict							= None
           if self.use_labels:
                 lowerCAmelCase       :						Tuple							= ids_tensor([self.batch_size]       ,					self.type_sequence_label_size					)
                 lowerCAmelCase       :						Union[str, Any]							= ids_tensor([self.batch_size, self.seq_length]       ,					self.num_labels					)
                 lowerCAmelCase       :						Union[str, Any]							= ids_tensor([self.batch_size]       ,					self.num_choices					)
                 lowerCAmelCase       :						Union[str, Any]							= ids_tensor([self.batch_size, self.seq_length]       ,					1					)

           lowerCAmelCase       :						Optional[Any]							= self.get_config()

           return (
               config,
               input_ids,
               token_type_ids,
               input_mask,
               sequence_labels,
               token_labels,
               choice_labels,
               fake_token_labels,
           )






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           return ElectraConfig(
               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       ,					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=UpperCamelCase_       ,					initializer_range=self.initializer_range       ,					)






     def   lowerCamelCase__  (						self	:       List[Any]					):
           (
               (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   (
               lowerCAmelCase
           ),   
           )       :						Union[str, Any]							= self.prepare_config_and_inputs()

           lowerCAmelCase       :						Optional[Any]							= True
           lowerCAmelCase       :						List[str]							= floats_tensor([self.batch_size, self.seq_length, self.hidden_size]					)
           lowerCAmelCase       :						Optional[int]							= ids_tensor([self.batch_size, self.seq_length]       ,					vocab_size=2					)

           return (
               config,
               input_ids,
               token_type_ids,
               input_mask,
               sequence_labels,
               token_labels,
               choice_labels,
               encoder_hidden_states,
               encoder_attention_mask,
           )






     def   lowerCamelCase__  (						self	:       List[str]       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[str]       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       List[str]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[str]       ,					):
           lowerCAmelCase       :						List[Any]							= ElectraModel(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Dict							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_					)
           lowerCAmelCase       :						Tuple							= model(UpperCamelCase_       ,					token_type_ids=UpperCamelCase_					)
           lowerCAmelCase       :						Optional[int]							= model(UpperCamelCase_					)
           self.parent.assertEqual(result.last_hidden_state.shape       ,					(self.batch_size, self.seq_length, self.hidden_size)					)






     def   lowerCamelCase__  (						self	:       Optional[int]       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       int       ,					):
           lowerCAmelCase       :						List[str]							= True
           lowerCAmelCase       :						str							= ElectraModel(UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Any							= model(
               UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					encoder_hidden_states=UpperCamelCase_       ,					encoder_attention_mask=UpperCamelCase_       ,					)
           lowerCAmelCase       :						List[str]							= model(
               UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					encoder_hidden_states=UpperCamelCase_       ,					)
           lowerCAmelCase       :						List[str]							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_					)
           self.parent.assertEqual(result.last_hidden_state.shape       ,					(self.batch_size, self.seq_length, self.hidden_size)					)






     def   lowerCamelCase__  (						self	:       int       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       List[str]       ,					UpperCamelCase_	:       Optional[int]       ,					):
           lowerCAmelCase       :						Optional[int]							= ElectraForMaskedLM(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Optional[int]							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.seq_length, self.vocab_size)					)






     def   lowerCamelCase__  (						self	:       Any       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       Optional[Any]       ,					):
           lowerCAmelCase       :						List[Any]							= ElectraForCausalLM(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						int							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.seq_length, self.vocab_size)					)






     def   lowerCamelCase__  (						self	:       Any       ,					UpperCamelCase_	:       str       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Optional[Any]       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Optional[Any]       ,					UpperCamelCase_	:       Tuple       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       Optional[int]       ,					):
           lowerCAmelCase       :						Dict							= self.num_labels
           lowerCAmelCase       :						List[str]							= ElectraForTokenClassification(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Optional[int]							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.seq_length, self.num_labels)					)






     def   lowerCamelCase__  (						self	:       List[Any]       ,					UpperCamelCase_	:       str       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       List[str]       ,					UpperCamelCase_	:       List[Any]       ,					):
           lowerCAmelCase       :						List[Any]							= self.num_labels
           lowerCAmelCase       :						Union[str, Any]							= ElectraForPreTraining(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						str							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.seq_length)					)






     def   lowerCamelCase__  (						self	:       int       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       Tuple       ,					):
           lowerCAmelCase       :						Tuple							= self.num_labels
           lowerCAmelCase       :						Any							= ElectraForSequenceClassification(UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Dict							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.num_labels)					)






     def   lowerCamelCase__  (						self	:       List[str]       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       List[Any]       ,					UpperCamelCase_	:       Optional[Any]       ,					UpperCamelCase_	:       str       ,					):
           lowerCAmelCase       :						Tuple							= ElectraForQuestionAnswering(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						Union[str, Any]							= model(
               UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					start_positions=UpperCamelCase_       ,					end_positions=UpperCamelCase_       ,					)
           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	:       Dict       ,					UpperCamelCase_	:       int       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Optional[Any]       ,					UpperCamelCase_	:       Dict       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       Any       ,					UpperCamelCase_	:       Union[str, Any]       ,					):
           lowerCAmelCase       :						Tuple							= self.num_choices
           lowerCAmelCase       :						Optional[Any]							= ElectraForMultipleChoice(config=UpperCamelCase_					)
           model.to(UpperCamelCase_					)
           model.eval()
           lowerCAmelCase       :						str							= input_ids.unsqueeze(1					).expand(-1       ,					self.num_choices       ,					-1					).contiguous()
           lowerCAmelCase       :						Union[str, Any]							= token_type_ids.unsqueeze(1					).expand(-1       ,					self.num_choices       ,					-1					).contiguous()
           lowerCAmelCase       :						str							= input_mask.unsqueeze(1					).expand(-1       ,					self.num_choices       ,					-1					).contiguous()
           lowerCAmelCase       :						Any							= model(
               UpperCamelCase_       ,					attention_mask=UpperCamelCase_       ,					token_type_ids=UpperCamelCase_       ,					labels=UpperCamelCase_       ,					)
           self.parent.assertEqual(result.logits.shape       ,					(self.batch_size, self.num_choices)					)






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



@require_torch
class 		snake_case_(							a__				,       a__				,       unittest.TestCase      ):
     __UpperCamelCase	=       (
         (
             ElectraModel,
             ElectraForPreTraining,
             ElectraForMaskedLM,
             ElectraForCausalLM,
             ElectraForMultipleChoice,
             ElectraForTokenClassification,
             ElectraForSequenceClassification,
             ElectraForQuestionAnswering,
         )
         if is_torch_available()
         else ()
     )
     __UpperCamelCase	=       (
         {
             '''feature-extraction''': ElectraModel,
             '''fill-mask''': ElectraForMaskedLM,
             '''question-answering''': ElectraForQuestionAnswering,
             '''text-classification''': ElectraForSequenceClassification,
             '''text-generation''': ElectraForCausalLM,
             '''token-classification''': ElectraForTokenClassification,
             '''zero-shot''': ElectraForSequenceClassification,
         }
         if is_torch_available()
         else {}
     )
     __UpperCamelCase	=       True






     def   lowerCamelCase__  (						self	:       List[str]       ,					UpperCamelCase_	:       Optional[int]       ,					UpperCamelCase_	:       Union[str, Any]       ,					UpperCamelCase_	:       List[str]=False					):
           lowerCAmelCase       :						Tuple							= super()._prepare_for_class(UpperCamelCase_       ,					UpperCamelCase_       ,					return_labels=UpperCamelCase_					)

           if return_labels:
                 if model_class in get_values(UpperCamelCase_					):
                       lowerCAmelCase       :						Tuple							= torch.zeros(
                           (self.model_tester.batch_size, self.model_tester.seq_length)       ,					dtype=torch.long       ,					device=UpperCamelCase_					)
           return inputs_dict






     def   lowerCamelCase__  (						self	:       List[str]					):
           lowerCAmelCase       :						Optional[Any]							= ElectraModelTester(self					)
           lowerCAmelCase       :						str							= ConfigTester(self       ,					config_class=UpperCamelCase_       ,					hidden_size=3_7					)






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           self.config_tester.run_common_tests()






     def   lowerCamelCase__  (						self	:       List[Any]					):
           lowerCAmelCase       :						List[Any]							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_model(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Optional[Any]					):
           lowerCAmelCase       :						str							= self.model_tester.prepare_config_and_inputs_for_decoder()
           self.model_tester.create_and_check_electra_model_as_decoder(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Dict					):
           lowerCAmelCase       :						Any							= self.model_tester.prepare_config_and_inputs()
           for type in ["absolute", "relative_key", "relative_key_query"]:
                 lowerCAmelCase       :						Union[str, Any]							= type
                 self.model_tester.create_and_check_electra_model(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       int					):
           lowerCAmelCase       :						List[str]							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_masked_lm(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Dict					):
           lowerCAmelCase       :						Tuple							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_token_classification(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Optional[Any]					):
           lowerCAmelCase       :						Optional[Any]							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_pretraining(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Any					):
           lowerCAmelCase       :						Any							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_sequence_classification(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       int					):
           lowerCAmelCase       :						Union[str, Any]							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_question_answering(*UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Any					):
           lowerCAmelCase       :						Tuple							= self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_electra_for_multiple_choice(*UpperCamelCase_					)






     @slow
     def   lowerCamelCase__  (						self	:       str					):
           for model_name in ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                 lowerCAmelCase       :						Optional[Any]							= ElectraModel.from_pretrained(UpperCamelCase_					)
                 self.assertIsNotNone(UpperCamelCase_					)






     def   lowerCamelCase__  (						self	:       Any					):
           lowerCAmelCase       :						List[str]							= self.model_tester.prepare_config_and_inputs_for_decoder()
           self.model_tester.create_and_check_electra_for_causal_lm(*UpperCamelCase_					)



@require_torch
class 		snake_case_(							unittest.TestCase      ):






     @slow
     def   lowerCamelCase__  (						self	:       Optional[Any]					):
           lowerCAmelCase       :						List[str]							= ElectraModel.from_pretrained('''google/electra-small-discriminator'''					)
           lowerCAmelCase       :						Union[str, Any]							= torch.tensor([[0, 3_4_5, 2_3_2, 3_2_8, 7_4_0, 1_4_0, 1_6_9_5, 6_9, 6_0_7_8, 1_5_8_8, 2]]					)
           lowerCAmelCase       :						Any							= torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]					)
           lowerCAmelCase       :						List[str]							= model(UpperCamelCase_       ,					attention_mask=UpperCamelCase_					)[0]
           lowerCAmelCase       :						List[Any]							= torch.Size((1, 1_1, 2_5_6)					)
           self.assertEqual(output.shape       ,					UpperCamelCase_					)
           lowerCAmelCase       :						str							= torch.tensor(
               [[[0.4_471, 0.6_821, -0.3_265], [0.4_627, 0.5_255, -0.3_668], [0.4_532, 0.3_313, -0.4_344]]]					)

           self.assertTrue(torch.allclose(output[:, 1:4, 1:4]       ,					UpperCamelCase_       ,					atol=1E-4					)					)






"""simple docstring"""





from doctest import testmod
from math import sqrt


def   _snake_case    (    _snake_case					:      int      ):
      lowerCAmelCase       :						list[int]							= []
      if num < 1:
            return facs
      facs.append(1      )
      if num == 1:
            return facs
      facs.append(_snake_case      )
      for i in range(2			, int(sqrt(_snake_case      )      ) + 1      ):
            if num % i == 0:  # If i is a factor of num
                  facs.append(_snake_case      )
                  lowerCAmelCase       :						Dict							= num // i  # num//i is the other factor of num
                  if d != i:  # If d and i are distinct
                        facs.append(_snake_case      )  # we have found another factor
      facs.sort()
      return facs


if __name__ == "__main__":
 testmod(name='''factors_of_a_number''', verbose=True)


