
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       UpperCAmelCase__					(						self  :  List[str] ):
        """simple docstring"""







        __lowerCAmelCase         =							10







       def       UpperCAmelCase__					(						self  :  List[Any] ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  Optional[Any] ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  Tuple ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  int ):
        """simple docstring"""







        __lowerCAmelCase         =							'''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         =							process_story(lowerCamelCase_ )
        self.assertEqual(lowerCamelCase_      ,				[] )







       def       UpperCAmelCase__					(						self  :  Optional[int] ):
        """simple docstring"""







        __lowerCAmelCase         =							''''''
        __lowerCAmelCase         =							process_story(lowerCamelCase_ )
        self.assertEqual(lowerCamelCase_      ,				[] )
        self.assertEqual(lowerCamelCase_      ,				[] )







       def       UpperCAmelCase__					(						self  :  Tuple ):
        """simple docstring"""







        __lowerCAmelCase         =							(
            '''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         =							process_story(lowerCamelCase_ )

        __lowerCAmelCase         =							[
            '''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(lowerCamelCase_      ,				lowerCamelCase_ )

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







       def       UpperCAmelCase__					(						self  :  Any ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  Tuple ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  Optional[int] ):
        """simple docstring"""







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







       def       UpperCAmelCase__					(						self  :  Optional[int] ):
        """simple docstring"""







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

        __lowerCAmelCase         =							compute_token_type_ids(lowerCamelCase_      ,				lowerCamelCase_ )
        np.testing.assert_array_equal(lowerCamelCase_      ,				lowerCamelCase_ )








from abc import ABC, abstractmethod
from argparse import ArgumentParser

class       a		(   __UpperCAmelCase					):







							@staticmethod
							@abstractmethod
							def       UpperCAmelCase__					(						snake_case__  :  ArgumentParser ):
								"""simple docstring"""







								raise NotImplementedError()







							@abstractmethod
							def       UpperCAmelCase__					(						self  :  Any ):
								"""simple docstring"""







								raise NotImplementedError()






