"""simple docstring"""




import unittest

import numpy as np
import torch

from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad
class 						__A							( unittest.TestCase		):






     def     __A  (		self  ):
       _lowerCAmelCase						:       int  			=     10






     def     __A  (		self  ):
       _lowerCAmelCase						:       str  			=     [1, 2, 3, 4]
       _lowerCAmelCase						:       int  			=     [1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
       self.assertEqual(truncate_or_pad(a__				,     self.block_size				,     0  )				,     a__  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       int  			=     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
       _lowerCAmelCase						:       Any  			=     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
       self.assertEqual(truncate_or_pad(a__				,     self.block_size				,     0  )				,     a__  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       str  			=     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
       _lowerCAmelCase						:       Optional[Any]  			=     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
       self.assertEqual(truncate_or_pad(a__				,     self.block_size				,     0  )				,     a__  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       Union[str, Any]  			=     """It was the year of Our Lord one thousand seven hundred and
        seventy-five.\n\nSpiritual revelations were conceded to England at that
        favoured period, as at this."""
       _lowerCAmelCase			,	_lowerCAmelCase						:       Optional[int]  			=     process_story(a__  )
       self.assertEqual(a__				,     []  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       List[Any]  			=     """"""
       _lowerCAmelCase			,	_lowerCAmelCase						:       Union[str, Any]  			=     process_story(a__  )
       self.assertEqual(a__				,     []  )
       self.assertEqual(a__				,     []  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       str  			=     (
           """It was the year of Our Lord one thousand seven hundred and """
           """seventy-five\n\nSpiritual revelations were conceded to England """
           """at that favoured period, as at this.\n@highlight\n\nIt was the best of times"""
       )
       _lowerCAmelCase			,	_lowerCAmelCase						:       List[str]  			=     process_story(a__  )

       _lowerCAmelCase						:       Union[str, Any]  			=     [
           """It was the year of Our Lord one thousand seven hundred and seventy-five.""",
           """Spiritual revelations were conceded to England at that favoured period, as at this.""",
       ]
       self.assertEqual(a__				,     a__  )

       _lowerCAmelCase						:       List[str]  			=     ["""It was the best of times."""]
       self.assertEqual(a__				,     a__  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       Any  			=     torch.tensor([1, 2, 3, 4]  )
       _lowerCAmelCase						:       Union[str, Any]  			=     torch.tensor([1, 1, 1, 1]  )
       np.testing.assert_array_equal(build_mask(a__				,     0  ).numpy()				,     expected.numpy()  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       Tuple  			=     torch.tensor([1, 2, 3, 4, 23, 23, 23]  )
       _lowerCAmelCase						:       Any  			=     torch.tensor([1, 1, 1, 1, 0, 0, 0]  )
       np.testing.assert_array_equal(build_mask(a__				,     23  ).numpy()				,     expected.numpy()  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       Tuple  			=     torch.tensor([8, 2, 3, 4, 1, 1, 1]  )
       _lowerCAmelCase						:       Dict  			=     torch.tensor([1, 1, 1, 1, 0, 0, 0]  )
       np.testing.assert_array_equal(build_mask(a__				,     1  ).numpy()				,     expected.numpy()  )






     def     __A  (		self  ):
       _lowerCAmelCase						:       int  			=     101
       _lowerCAmelCase						:       Tuple  			=     torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 101, 5, 6], [1, 101, 3, 4, 101, 6]]  )
       _lowerCAmelCase						:       Dict  			=     torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]  )

       _lowerCAmelCase						:       int  			=     compute_token_type_ids(a__				,     a__  )
       np.testing.assert_array_equal(a__				,     a__  )








'''simple docstring'''

from __future__ import annotations





def __snake_case					(      UpperCAmelCase_						:						int		):
 lowerCamelCase_      =  2
 lowerCamelCase_      =  []
 while i * i <= n:
  if n % i:
   i += 1
  else:
   n //= i
   factors.append(UpperCAmelCase_		)
 if n > 1:
  factors.append(UpperCAmelCase_		)
 return factors


if __name__ == "__main__":
     import doctest

     doctest.testmod()



