




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 	lowercase_      (			lowercase     ):






      '''simple docstring'''




      __snake_case  						=						42






class 	lowercase_      (			unittest.TestCase     ):






      '''simple docstring'''




      def    __lowerCAmelCase      (   self   :		Optional[int]						)					->str:




       """simple docstring"""


       a							=   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
       a							=   CustomOutput(images=[PIL.Image.new('''RGB'''				,      (4, 4)						)]						)

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







      def    __lowerCAmelCase      (   self   :		Dict						)					->List[Any]:




       """simple docstring"""


       a							=   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
       a							=   CustomOutput({'''images''': [PIL.Image.new('''RGB'''				,      (4, 4)						)]}						)

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










from ...utils import is_transformers_available
from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline


if is_transformers_available():
     from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline


