


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						):







       def 		snake_case_	(			self: List[Any]					):






            '''simple docstring'''




            __UpperCamelCase =			10







       def 		snake_case_	(			self: Optional[Any]					):






            '''simple docstring'''




            __UpperCamelCase =			[1, 2, 3, 4]
            __UpperCamelCase =			[1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
            self.assertEqual(truncate_or_pad(A_,self.block_size,0					),A_					)







       def 		snake_case_	(			self: Optional[int]					):






            '''simple docstring'''




            __UpperCamelCase =			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
            __UpperCamelCase =			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
            self.assertEqual(truncate_or_pad(A_,self.block_size,0					),A_					)







       def 		snake_case_	(			self: Dict					):






            '''simple docstring'''




            __UpperCamelCase =			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
            __UpperCamelCase =			[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
            self.assertEqual(truncate_or_pad(A_,self.block_size,0					),A_					)







       def 		snake_case_	(			self: str					):






            '''simple docstring'''




            __UpperCamelCase =			'It was the year of Our Lord one thousand seven hundred and\n        seventy-five.\n\nSpiritual revelations were conceded to England at that\n        favoured period, as at this.'
            __UpperCamelCase,    __UpperCamelCase =			process_story(A_					)
            self.assertEqual(A_,[]					)







       def 		snake_case_	(			self: Optional[int]					):






            '''simple docstring'''




            __UpperCamelCase =			''
            __UpperCamelCase,    __UpperCamelCase =			process_story(A_					)
            self.assertEqual(A_,[]					)
            self.assertEqual(A_,[]					)







       def 		snake_case_	(			self: List[str]					):






            '''simple docstring'''




            __UpperCamelCase =			(
                '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'
            )
            __UpperCamelCase,    __UpperCamelCase =			process_story(A_					)

            __UpperCamelCase =			[
                '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_					)

            __UpperCamelCase =			['It was the best of times.']
            self.assertEqual(A_,A_					)







       def 		snake_case_	(			self: str					):






            '''simple docstring'''




            __UpperCamelCase =			torch.tensor([1, 2, 3, 4]					)
            __UpperCamelCase =			torch.tensor([1, 1, 1, 1]					)
            np.testing.assert_array_equal(build_mask(A_,0					).numpy(),expected.numpy()					)







       def 		snake_case_	(			self: str					):






            '''simple docstring'''




            __UpperCamelCase =			torch.tensor([1, 2, 3, 4, 23, 23, 23]					)
            __UpperCamelCase =			torch.tensor([1, 1, 1, 1, 0, 0, 0]					)
            np.testing.assert_array_equal(build_mask(A_,23					).numpy(),expected.numpy()					)







       def 		snake_case_	(			self: Dict					):






            '''simple docstring'''




            __UpperCamelCase =			torch.tensor([8, 2, 3, 4, 1, 1, 1]					)
            __UpperCamelCase =			torch.tensor([1, 1, 1, 1, 0, 0, 0]					)
            np.testing.assert_array_equal(build_mask(A_,1					).numpy(),expected.numpy()					)







       def 		snake_case_	(			self: Dict					):






            '''simple docstring'''




            __UpperCamelCase =			101
            __UpperCamelCase =			torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 101, 5, 6], [1, 101, 3, 4, 101, 6]]					)
            __UpperCamelCase =			torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]					)

            __UpperCamelCase =			compute_token_type_ids(A_,A_					)
            np.testing.assert_array_equal(A_,A_					)






def 		_A		(		_lowercase )					-> int:


     """simple docstring"""


     assert column_title.isupper()
     __UpperCamelCase =			0
     __UpperCamelCase =			len(_lowercase ) - 1
     __UpperCamelCase =			0

     while index >= 0:
          __UpperCamelCase =			(ord(column_title[index] ) - 64) * pow(26					,  _lowercase )
          answer += value
          power += 1
          index -= 1

     return answer


if __name__ == "__main__":
    from doctest import testmod

    testmod()


