code: 
  
  
  
  
  
  
  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 							UpperCAmelCase_     (		__lowerCamelCase		):
       __lowerCamelCase										=     42
  
  
  
  
  
  
  
  class 							UpperCAmelCase_     (		unittest.TestCase		):
  
  
  
  
       def      __UpperCAmelCase     (							self		):
            UpperCAmelCase__			:     Optional[Any]										= 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__			:     Union[str, Any]										= CustomOutput(images=[PIL.Image.new("""RGB"""  ,	(4, 4)		)]		)
  
            # check every way of getting the attribute
            assert isinstance(outputs.images  ,	_lowerCAmelCase		)
            assert isinstance(outputs.images[0]  ,	PIL.Image.Image		)
            assert isinstance(outputs["""images"""]  ,	_lowerCAmelCase		)
            assert isinstance(outputs["""images"""][0]  ,	PIL.Image.Image		)
            assert isinstance(outputs[0]  ,	_lowerCAmelCase		)
            assert isinstance(outputs[0][0]  ,	PIL.Image.Image		)
  
  
  
  
       def      __UpperCAmelCase     (							self		):
            # test output reinitialization with a `dict` for compatibility with `accelerate`
            UpperCAmelCase__			:     Union[str, Any]										= 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__			:     str										= CustomOutput({"""images""": [PIL.Image.new("""RGB"""  ,	(4, 4)		)]}		)
  
            # check every way of getting the attribute
            assert isinstance(outputs.images  ,	_lowerCAmelCase		)
            assert isinstance(outputs.images[0]  ,	PIL.Image.Image		)
            assert isinstance(outputs["""images"""]  ,	_lowerCAmelCase		)
            assert isinstance(outputs["""images"""][0]  ,	PIL.Image.Image		)
            assert isinstance(outputs[0]  ,	_lowerCAmelCase		)
            assert isinstance(outputs[0][0]  ,	PIL.Image.Image		)
  
  
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  
  
  
  
  
  
  
  class 							UpperCAmelCase_     :
  
  
  
  
       def __init__(							self  ,	_lowerCAmelCase		):
            UpperCAmelCase__			:     List[Any]										= value
            UpperCAmelCase__			:     Node | None										= None
            UpperCAmelCase__			:     Node | None										= None
  
  
  
  
  
  
  
  class 							UpperCAmelCase_     :
       __lowerCamelCase										=     42
  
  
  
  
       def __init__(							self		):
            UpperCAmelCase__			:     Any										= 0
  
  
  
  
       def      __UpperCAmelCase     (							self  ,	_lowerCAmelCase  ,	_lowerCAmelCase		):
            if node is None:
                 return
  
            if path_sum == self.target:
                 self.paths += 1
  
            if node.left:
                 self.depth_first_search(node.left  ,	path_sum + node.left.value		)
            if node.right:
                 self.depth_first_search(node.right  ,	path_sum + node.right.value		)
  
  
  
  
       def      __UpperCAmelCase     (							self  ,	_lowerCAmelCase  ,	_lowerCAmelCase = None		):
            if node is None:
                 return 0
            if target is not None:
                 UpperCAmelCase__			:     List[Any]										= target
  
            self.depth_first_search(_lowerCAmelCase  ,	node.value		)
            self.path_sum(node.left		)
            self.path_sum(node.right		)
  
            return self.paths
  
  
  if __name__ == "__main__":
        import doctest
  
        doctest.testmod()
  
  
  
  
  
  
  