

"""simple docstring"""




import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
	from PIL import Image





class     __UpperCamelCase				(     unittest.TestCase  ,	_A		):


		def       SCREAMING_SNAKE_CASE__     (self				:	Optional[Any]):
							A    =      load_tool("image-captioning")
							self.tool.setup()
							A    =      load_tool("image-captioning"  ,  remote=__SCREAMING_SNAKE_CASE)


		def       SCREAMING_SNAKE_CASE__     (self				:	List[str]):
							A    =      Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO")) / "000000039769.png")
							A    =      self.tool(__SCREAMING_SNAKE_CASE)
							self.assertEqual(__SCREAMING_SNAKE_CASE  ,  "two cats sleeping on a couch")


		def       SCREAMING_SNAKE_CASE__     (self				:	Union[str, Any]):
							A    =      Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO")) / "000000039769.png")
							A    =      self.remote_tool(__SCREAMING_SNAKE_CASE)
							self.assertEqual(__SCREAMING_SNAKE_CASE  ,  "two cats sleeping on a couch")


		def       SCREAMING_SNAKE_CASE__     (self				:	List[str]):
							A    =      Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO")) / "000000039769.png")
							A    =      self.tool(image=__SCREAMING_SNAKE_CASE)
							self.assertEqual(__SCREAMING_SNAKE_CASE  ,  "two cats sleeping on a couch")


		def       SCREAMING_SNAKE_CASE__     (self				:	Optional[int]):
							A    =      Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO")) / "000000039769.png")
							A    =      self.remote_tool(image=__SCREAMING_SNAKE_CASE)
							self.assertEqual(__SCREAMING_SNAKE_CASE  ,  "two cats sleeping on a couch")








"""simple docstring"""




def      __SCREAMING_SNAKE_CASE		(		lowercase__   ):
					"""simple docstring"""
					if not isinstance(lowercase__    ,							lowercase__   ):
										raise ValueError("double_factorial() only accepts integral values"   )
					if n < 0:
										raise ValueError("double_factorial() not defined for negative values"   )
					return 1 if n <= 1 else n * double_factorial(n - 2   )


if __name__ == "__main__":
	import doctest

	doctest.testmod()





