



import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput



@dataclass
class 		_lowercase		(							UpperCAmelCase__						):
   _UpperCAmelCase  						=      42
   _UpperCAmelCase  						=      None
   _UpperCAmelCase  						=      None



class 		_lowercase		(							unittest.TestCase						):

   def 		A				(   self      :							Any				)							->					Dict:


    """simple docstring"""






    a							=		ModelOutputTest(a=30				)
    self.assertEqual(x.a				, 30				)
    self.assertIsNone(x.b				)
    self.assertIsNone(x.c				)
    with self.assertRaises(__lowerCAmelCase				):
     a							=		x.d

   def 		A				(   self      :							int				)							->					int:


    """simple docstring"""






    a							=		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)				)

    a							=		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 		A				(   self      :							int				)							->					List[Any]:


    """simple docstring"""






    a							=		ModelOutputTest(a=30				, b=10				)
    self.assertEqual(x["a"]				, 30				)
    self.assertEqual(x["b"]				, 10				)
    with self.assertRaises(__lowerCAmelCase				):
     a							=		x["c"]

    a							=		ModelOutputTest(a=30				, c=10				)
    self.assertEqual(x["a"]				, 30				)
    self.assertEqual(x["c"]				, 10				)
    with self.assertRaises(__lowerCAmelCase				):
     a							=		x["b"]

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


    """simple docstring"""






    a							=		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(__lowerCAmelCase				)				, ["a"]				)

    a							=		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(__lowerCAmelCase				)				, ["a", "b"]				)

    a							=		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(__lowerCAmelCase				)				, ["a", "c"]				)

    with self.assertRaises(__lowerCAmelCase				):
     a							=		x.update({"d": 20}				)
    with self.assertRaises(__lowerCAmelCase				):
     del x["a"]
    with self.assertRaises(__lowerCAmelCase				):
     a							=		x.pop("a"				)
    with self.assertRaises(__lowerCAmelCase				):
     a							=		x.setdefault("d"				, 32				)

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


    """simple docstring"""






    a							=		ModelOutputTest(a=30				)
    a							=		10
    self.assertEqual(x.a				, 10				)
    self.assertEqual(x["a"]				, 10				)

   def 		A				(   self      :							List[Any]				)							->					List[str]:


    """simple docstring"""






    a							=		ModelOutputTest(a=30				)
    a							=		10
    self.assertEqual(x.a				, 10				)
    self.assertEqual(x["a"]				, 10				)

   def 		A				(   self      :							Any				)							->					Tuple:


    """simple docstring"""






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




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


    """simple docstring"""






    a							=		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(__lowerCAmelCase				):
     a							=		ModelOutputTest([("a", 30), (10, 10)]				)

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








def  A					(				UpperCAmelCase					):
					if not isinstance(UpperCAmelCase	,	UpperCAmelCase					):
										_snake_case							:       Optional[Any]												= F"""Input value of [number={number}] must be an integer"""
										raise TypeError(UpperCAmelCase					)
					if number < 1:
										raise ValueError("Input must be a positive integer"					)
					return number * (2 * number - 1)


if __name__ == "__main__":
							import doctest

							doctest.testmod()