'''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        __magic_name__		(       _UpperCAmelCase):
			UpperCamelCase__							=			42





class        __magic_name__		(       unittest.TestCase):







			def       SCREAMING_SNAKE_CASE_	(      self							:    str       ):
										lowercase_   :     Tuple									=			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
										lowercase_   :     Tuple									=			CustomOutput(images=[PIL.Image.new("""RGB"""							,     (4, 4)       )]       )

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







			def       SCREAMING_SNAKE_CASE_	(      self							:    Union[str, Any]       ):
										# test output reinitialization with a `dict` for compatibility with `accelerate`
										lowercase_   :     str									=			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
										lowercase_   :     str									=			CustomOutput({"""images""": [PIL.Image.new("""RGB"""							,     (4, 4)       )]}       )

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






'''simple docstring'''




import os
import unittest

import pytest
from parameterized import parameterized

from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device


# skipping in unittest tests

_lowercase		:					int													=		[(1,)]




def 				lowerCamelCase      ( )     -> Dict:
							lowercase_   :     Union[str, Any]									=			bool(os.getenv("""RUN_SLOW""" , 0					)					)
							if run_slow:
														assert True
							else:
														assert False, "should have been skipped"




def 				lowerCamelCase      ( )     -> List[str]:
							lowercase_   :     Union[str, Any]									=			bool(os.getenv("""RUN_SLOW""" , 0					)					)
							if run_slow and torch_device == "cuda":
														assert True
							else:
														assert False, "should have been skipped"





@require_torch
class        __magic_name__		(       unittest.TestCase):







			@slow
			@require_torch_gpu
			def       SCREAMING_SNAKE_CASE_	(      self							:    Dict       ):
										check_slow_torch_cuda()







			@require_torch_gpu
			@slow
			def       SCREAMING_SNAKE_CASE_	(      self							:    List[str]       ):
										check_slow_torch_cuda()







			@parameterized.expand(lowercase_       )
			@slow
			def       SCREAMING_SNAKE_CASE_	(      self							:    Tuple							,     lowercase_							:    Dict=None       ):
										check_slow()




@slow
@require_torch_gpu
def 				lowerCamelCase      ( )     -> Union[str, Any]:
							check_slow_torch_cuda()




@require_torch_gpu
@slow
def 				lowerCamelCase      ( )     -> Any:
							check_slow_torch_cuda()




@slow
@pytest.mark.parametrize("""param""" , [1]					)
def 				lowerCamelCase      ( UpperCAmelCase__			:   List[str]					)     -> List[Any]:
							check_slow()




@pytest.mark.parametrize("""param""" , [1]					)
@slow
def 				lowerCamelCase      ( UpperCAmelCase__			:   Optional[Any]					)     -> Any:
							check_slow()





