






"""simple docstring"""





import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput







@dataclass
class 		_a       (		lowercase_   ):





   '''simple docstring'''






   UpperCamelCase__      					=    42
   UpperCamelCase__      					=    None
   UpperCamelCase__      					=    None







class 		_a       (		unittest.TestCase   ):





   '''simple docstring'''






   def __lowercase    (   self)	-> Union[str, Any]:




          '''simple docstring'''




          lowercase__:    List[str]        =      ModelOutputTest(a=30)
          self.assertEqual(x.a			,				30)
          self.assertIsNone(x.b)
          self.assertIsNone(x.c)
          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    List[str]        =      x.d





   def __lowercase    (   self)	-> Tuple:




          '''simple docstring'''




          lowercase__:    List[str]        =      ModelOutputTest(a=30			,				b=10)
          self.assertEqual(x[0]			,				30)
          self.assertEqual(x[1]			,				10)
          self.assertEqual(x[:2]			,				(30, 10))
          self.assertEqual(x[:]			,				(30, 10))

          lowercase__:    Optional[Any]        =      ModelOutputTest(a=30			,				c=10)
          self.assertEqual(x[0]			,				30)
          self.assertEqual(x[1]			,				10)
          self.assertEqual(x[:2]			,				(30, 10))
          self.assertEqual(x[:]			,				(30, 10))





   def __lowercase    (   self)	-> Dict:




          '''simple docstring'''




          lowercase__:    List[Any]        =      ModelOutputTest(a=30			,				b=10)
          self.assertEqual(x["a"]			,				30)
          self.assertEqual(x["b"]			,				10)
          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    str        =      x["c"]

          lowercase__:    List[Any]        =      ModelOutputTest(a=30			,				c=10)
          self.assertEqual(x["a"]			,				30)
          self.assertEqual(x["c"]			,				10)
          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    str        =      x["b"]





   def __lowercase    (   self)	-> Optional[Any]:




          '''simple docstring'''




          lowercase__:    Optional[Any]        =      ModelOutputTest(a=30)
          self.assertEqual(list(x.keys())			,				["a"])
          self.assertEqual(list(x.values())			,				[30])
          self.assertEqual(list(x.items())			,				[("a", 30)])
          self.assertEqual(list(UpperCAmelCase_)			,				["a"])

          lowercase__:    Optional[Any]        =      ModelOutputTest(a=30			,				b=10)
          self.assertEqual(list(x.keys())			,				["a", "b"])
          self.assertEqual(list(x.values())			,				[30, 10])
          self.assertEqual(list(x.items())			,				[("a", 30), ("b", 10)])
          self.assertEqual(list(UpperCAmelCase_)			,				["a", "b"])

          lowercase__:    str        =      ModelOutputTest(a=30			,				c=10)
          self.assertEqual(list(x.keys())			,				["a", "c"])
          self.assertEqual(list(x.values())			,				[30, 10])
          self.assertEqual(list(x.items())			,				[("a", 30), ("c", 10)])
          self.assertEqual(list(UpperCAmelCase_)			,				["a", "c"])

          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    Any        =      x.update({"d": 20})
          with self.assertRaises(UpperCAmelCase_):
                 del x["a"]
          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    Optional[int]        =      x.pop("a")
          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    str        =      x.setdefault("d"			,				32)





   def __lowercase    (   self)	-> Any:




          '''simple docstring'''




          lowercase__:    str        =      ModelOutputTest(a=30)
          lowercase__:    Optional[Any]        =      10
          self.assertEqual(x.a			,				10)
          self.assertEqual(x["a"]			,				10)





   def __lowercase    (   self)	-> List[str]:




          '''simple docstring'''




          lowercase__:    Optional[int]        =      ModelOutputTest(a=30)
          lowercase__:    str        =      10
          self.assertEqual(x.a			,				10)
          self.assertEqual(x["a"]			,				10)





   def __lowercase    (   self)	-> List[str]:




          '''simple docstring'''




          lowercase__:    List[str]        =      ModelOutputTest({"a": 30, "b": 10})
          self.assertEqual(list(x.keys())			,				["a", "b"])
          self.assertEqual(x.a			,				30)
          self.assertEqual(x.b			,				10)





   def __lowercase    (   self)	-> List[str]:




          '''simple docstring'''




          lowercase__:    str        =      ModelOutputTest([("a", 30), ("b", 10)])
          self.assertEqual(list(x.keys())			,				["a", "b"])
          self.assertEqual(x.a			,				30)
          self.assertEqual(x.b			,				10)

          with self.assertRaises(UpperCAmelCase_):
                 lowercase__:    Dict        =      ModelOutputTest([("a", 30), (10, 10)])

          lowercase__:    str        =      ModelOutputTest(a=(30, 30))
          self.assertEqual(list(x.keys())			,				["a"])
          self.assertEqual(x.a			,				(30, 30))














"""simple docstring"""





def     A(  snake_case_		):
       """simple docstring"""





       if not isinstance(snake_case_						,       snake_case_		):
              raise ValueError("Input series is not valid, valid series - [1, 2/3, 2]"		)
       if len(snake_case_		) == 0:
              raise ValueError("Input list must be a non empty list"		)
       if len(snake_case_		) == 1 and series[0] != 0:
              return True
       lowercase__:    str        =      []
       lowercase__:    Optional[int]        =      len(snake_case_		)
       for i in range(0						,       snake_case_		):
              if series[i] == 0:
                     raise ValueError("Input series cannot have 0 as an element"		)
              rec_series.append(1 / series[i]		)
       lowercase__:    Optional[int]        =      rec_series[1] - rec_series[0]
       for index in range(2						,       snake_case_		):
              if rec_series[index] - rec_series[index - 1] != common_diff:
                     return False
       return True






def     A(  snake_case_		):
       """simple docstring"""





       if not isinstance(snake_case_						,       snake_case_		):
              raise ValueError("Input series is not valid, valid series - [2, 4, 6]"		)
       if len(snake_case_		) == 0:
              raise ValueError("Input list must be a non empty list"		)
       lowercase__:    Optional[int]        =      0
       for val in series:
              answer += 1 / val
       return len(snake_case_		) / answer


if __name__ == "__main__":
  import doctest

  doctest.testmod()






