"""simple docstring"""






import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput
@dataclass
class 							snake_case			(					__snake_case							):




					"""simple docstring"""

					snake_case__							       =					42






class 							snake_case			(					unittest.TestCase							):




					"""simple docstring"""

					def 						__lowerCAmelCase		(							self  :      Dict     ):
									UpperCAmelCase__			 =				CustomOutput(images=np.random.rand(1       ,3       ,4       ,4     )     )

									# check every way of getting the attribute
									assert isinstance(outputs.images       ,np.ndarray     )
									assert outputs.images.shape == (1, 3, 4, 4)
									assert isinstance(outputs['images']       ,np.ndarray     )
									assert outputs["images"].shape == (1, 3, 4, 4)
									assert isinstance(outputs[0]       ,np.ndarray     )
									assert outputs[0].shape == (1, 3, 4, 4)

									# test with a non-tensor attribute
									UpperCAmelCase__			 =				CustomOutput(images=[PIL.Image.new('RGB'       ,(4, 4)     )]     )

									# check every way of getting the attribute
									assert isinstance(outputs.images       ,__A     )
									assert isinstance(outputs.images[0]       ,PIL.Image.Image     )
									assert isinstance(outputs['images']       ,__A     )
									assert isinstance(outputs['images'][0]       ,PIL.Image.Image     )
									assert isinstance(outputs[0]       ,__A     )
									assert isinstance(outputs[0][0]       ,PIL.Image.Image     )







					def 						__lowerCAmelCase		(							self  :      Tuple     ):
									UpperCAmelCase__			 =				CustomOutput({'images': np.random.rand(1       ,3       ,4       ,4     )}     )

									# check every way of getting the attribute
									assert isinstance(outputs.images       ,np.ndarray     )
									assert outputs.images.shape == (1, 3, 4, 4)
									assert isinstance(outputs['images']       ,np.ndarray     )
									assert outputs["images"].shape == (1, 3, 4, 4)
									assert isinstance(outputs[0]       ,np.ndarray     )
									assert outputs[0].shape == (1, 3, 4, 4)

									# test with a non-tensor attribute
									UpperCAmelCase__			 =				CustomOutput({'images': [PIL.Image.new('RGB'       ,(4, 4)     )]}     )

									# check every way of getting the attribute
									assert isinstance(outputs.images       ,__A     )
									assert isinstance(outputs.images[0]       ,PIL.Image.Image     )
									assert isinstance(outputs['images']       ,__A     )
									assert isinstance(outputs['images'][0]       ,PIL.Image.Image     )
									assert isinstance(outputs[0]       ,__A     )
									assert isinstance(outputs[0][0]       ,PIL.Image.Image     )











"""simple docstring"""







from __future__ import annotations

from collections.abc import Iterator
from typing import Any







class 							_SCREAMING_SNAKE_CASE    :





							"""simple docstring"""





							def __init__( self:  Optional[int]					,		__A:  Any     ):

												'''simple docstring'''

												a__ 							=	data
												a__ 							=	None





							def __str__( self:  str     ):

												'''simple docstring'''

												return F'{self.data}'







class 							_SCREAMING_SNAKE_CASE    :





							"""simple docstring"""





							def __init__( self:  int     ):

												'''simple docstring'''

												a__ 							=	None
												a__ 							=	None




							def __iter__( self:  Tuple     ):

												'''simple docstring'''

												a__ 							=	self.front
												while node:
																	yield node.data
																	a__ 							=	node.next




							def __len__( self:  Union[str, Any]     ):

												'''simple docstring'''

												return len(tuple(iter(self     )     )     )




							def __str__( self:  Any     ):

												'''simple docstring'''

												return " <- ".join(str(__A     ) for item in self     )




							def 			lowercase		( self:  Any     ):

												'''simple docstring'''

												return len(self     ) == 0




							def 			lowercase		( self:  Tuple					,		__A:  Any     ):

												'''simple docstring'''

												a__ 							=	Node(__A     )
												if self.is_empty():
																	a__ 							=	a__ 							=	node
												else:
																	assert isinstance(self.rear					,		__A     )
																	a__ 							=	node
																	a__ 							=	node




							def 			lowercase		( self:  List[Any]     ):

												'''simple docstring'''

												if self.is_empty():
																	raise IndexError('''dequeue from empty queue'''     )
												assert isinstance(self.front					,		__A     )
												a__ 							=	self.front
												a__ 							=	self.front.next
												if self.front is None:
																	a__ 							=	None
												return node.data





							def 			lowercase		( self:  Dict     ):

												'''simple docstring'''

												a__ 							=	a__ 							=	None


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

	testmod()


