

'''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 lowerCamelCase			(  unittest.TestCase						):



   '''simple docstring'''






   def lowercase__						(				self	:						int			)      ->		Tuple:





         '''simple docstring'''
         A__					:       Any     =10


   def lowercase__						(				self	:						int			)      ->		Optional[int]:





         '''simple docstring'''
         A__					:       Dict     =[1, 2, 3, 4]
         A__					:       List[str]     =[1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
         self.assertEqual(truncate_or_pad(__lowercase		,      self.block_size		,      0			)		,      __lowercase			)


   def lowercase__						(				self	:						int			)      ->		Dict:





         '''simple docstring'''
         A__					:       List[Any]     =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
         A__					:       Optional[Any]     =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
         self.assertEqual(truncate_or_pad(__lowercase		,      self.block_size		,      0			)		,      __lowercase			)


   def lowercase__						(				self	:						List[str]			)      ->		Dict:





         '''simple docstring'''
         A__					:       Optional[int]     =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
         A__					:       Union[str, Any]     =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
         self.assertEqual(truncate_or_pad(__lowercase		,      self.block_size		,      0			)		,      __lowercase			)


   def lowercase__						(				self	:						Optional[Any]			)      ->		Optional[int]:





         '''simple docstring'''
         A__					:       List[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."""
         A__   ,						A__					:       int     =process_story(__lowercase			)
         self.assertEqual(__lowercase		,      []			)


   def lowercase__						(				self	:						Optional[int]			)      ->		Tuple:





         '''simple docstring'''
         A__					:       int     =""""""
         A__   ,						A__					:       Optional[Any]     =process_story(__lowercase			)
         self.assertEqual(__lowercase		,      []			)
         self.assertEqual(__lowercase		,      []			)


   def lowercase__						(				self	:						Dict			)      ->		Dict:





         '''simple docstring'''
         A__					:       int     =(
             """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"""
         )
         A__   ,						A__					:       Tuple     =process_story(__lowercase			)

         A__					:       List[str]     =[
             """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(__lowercase		,      __lowercase			)

         A__					:       List[Any]     =["""It was the best of times."""]
         self.assertEqual(__lowercase		,      __lowercase			)


   def lowercase__						(				self	:						List[Any]			)      ->		Dict:





         '''simple docstring'''
         A__					:       Tuple     =torch.tensor([1, 2, 3, 4]			)
         A__					:       Union[str, Any]     =torch.tensor([1, 1, 1, 1]			)
         np.testing.assert_array_equal(build_mask(__lowercase		,      0			).numpy()		,      expected.numpy()			)


   def lowercase__						(				self	:						Tuple			)      ->		Any:





         '''simple docstring'''
         A__					:       str     =torch.tensor([1, 2, 3, 4, 23, 23, 23]			)
         A__					:       Optional[Any]     =torch.tensor([1, 1, 1, 1, 0, 0, 0]			)
         np.testing.assert_array_equal(build_mask(__lowercase		,      23			).numpy()		,      expected.numpy()			)


   def lowercase__						(				self	:						int			)      ->		Any:





         '''simple docstring'''
         A__					:       Tuple     =torch.tensor([8, 2, 3, 4, 1, 1, 1]			)
         A__					:       Optional[int]     =torch.tensor([1, 1, 1, 1, 0, 0, 0]			)
         np.testing.assert_array_equal(build_mask(__lowercase		,      1			).numpy()		,      expected.numpy()			)



   def lowercase__						(				self	:						Optional[int]			)      ->		Tuple:





         '''simple docstring'''
         A__					:       Tuple     =1_01
         A__					:       Optional[int]     =torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 1_01, 5, 6], [1, 1_01, 3, 4, 1_01, 6]]			)
         A__					:       Optional[int]     =torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]			)

         A__					:       Optional[int]     =compute_token_type_ids(__lowercase		,      __lowercase			)
         np.testing.assert_array_equal(__lowercase		,      __lowercase			)




'''simple docstring'''



from __future__ import annotations
def 						__lowerCamelCase	(       __snake_case					:		list[int]	)	->							bool:






						"""simple docstring"""





						return len(set(__snake_case	)	) == len(__snake_case	)


if __name__ == "__main__":
		import doctest

		doctest.testmod()

