




import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput






@dataclass
class 	__magic_name__				(       snake_case							):
     UpperCamelCase_  :float
     UpperCamelCase_  :Optional[float]								=			None
     UpperCamelCase_  :Optional[float]								=			None






class 	__magic_name__				(       unittest.TestCase							):






     def   UpperCAmelCase_							(							self  )->    Optional[Any]:
         UpperCamelCase_      =	ModelOutputTest(a=30  )
         self.assertEqual(x.a		,	30  )
         self.assertIsNone(x.b  )
         self.assertIsNone(x.c  )
         with self.assertRaises(_lowercase  ):
             UpperCamelCase_      =	x.d






     def   UpperCAmelCase_							(							self  )->    List[Any]:
         UpperCamelCase_      =	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)  )

         UpperCamelCase_      =	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   UpperCAmelCase_							(							self  )->    Dict:
         UpperCamelCase_      =	ModelOutputTest(a=30		,	b=10  )
         self.assertEqual(x["a"]		,	30  )
         self.assertEqual(x["b"]		,	10  )
         with self.assertRaises(_lowercase  ):
             UpperCamelCase_      =	x["c"]

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






     def   UpperCAmelCase_							(							self  )->    List[str]:
         UpperCamelCase_      =	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(_lowercase  )		,	["a"]  )

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

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

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






     def   UpperCAmelCase_							(							self  )->    Dict:
         UpperCamelCase_      =	ModelOutputTest(a=30  )
         UpperCamelCase_      =	10
         self.assertEqual(x.a		,	10  )
         self.assertEqual(x["a"]		,	10  )






     def   UpperCAmelCase_							(							self  )->    Any:
         UpperCamelCase_      =	ModelOutputTest(a=30  )
         UpperCamelCase_      =	10
         self.assertEqual(x.a		,	10  )
         self.assertEqual(x["a"]		,	10  )






     def   UpperCAmelCase_							(							self  )->    Union[str, Any]:
         UpperCamelCase_      =	ModelOutputTest({"a": 30, "b": 10}  )
         self.assertEqual(list(x.keys()  )		,	["a", "b"]  )
         self.assertEqual(x.a		,	30  )
         self.assertEqual(x.b		,	10  )






     def   UpperCAmelCase_							(							self  )->    Optional[int]:
         UpperCamelCase_      =	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(_lowercase  ):
             UpperCamelCase_      =	ModelOutputTest([("a", 30), (10, 10)]  )

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



def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	float:



    """simple docstring"""






    return -num if num < 0 else num




def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	int:



    """simple docstring"""






    if len(SCREAMING_SNAKE_CASE_ ) == 0:
        raise ValueError("abs_min() arg is an empty sequence" )
    UpperCamelCase_      =	x[0]
    for i in x:
        if abs_val(SCREAMING_SNAKE_CASE_ ) < abs_val(SCREAMING_SNAKE_CASE_ ):
            UpperCamelCase_      =	i
    return j




def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	int:



    """simple docstring"""






    if len(SCREAMING_SNAKE_CASE_ ) == 0:
        raise ValueError("abs_max() arg is an empty sequence" )
    UpperCamelCase_      =	x[0]
    for i in x:
        if abs(SCREAMING_SNAKE_CASE_ ) > abs(SCREAMING_SNAKE_CASE_ ):
            UpperCamelCase_      =	i
    return j




def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	int:



    """simple docstring"""






    if len(SCREAMING_SNAKE_CASE_ ) == 0:
        raise ValueError("abs_max_sort() arg is an empty sequence" )
    return sorted(SCREAMING_SNAKE_CASE_ ,	key=SCREAMING_SNAKE_CASE_ )[-1]




def  lowerCAmelCase(			)->	Any:



    """simple docstring"""






    assert abs_val(0 ) == 0
    assert abs_val(3_4 ) == 3_4
    assert abs_val(-1_0_0_0_0_0_0_0_0_0_0_0 ) == 1_0_0_0_0_0_0_0_0_0_0_0

    UpperCamelCase_      =	[-3, -1, 2, -1_1]
    assert abs_max(SCREAMING_SNAKE_CASE_ ) == -1_1
    assert abs_max_sort(SCREAMING_SNAKE_CASE_ ) == -1_1
    assert abs_min(SCREAMING_SNAKE_CASE_ ) == -1


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 test_abs_val()
 print(abs_val(-34))  # --> 34
