



'''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      lowerCamelCase__     (     unittest.TestCase,     lowercase_				):






	'''simple docstring'''

	def      lowercase__							(  self		:  Any					)     ->			Any:




								'''simple docstring'''





								lowerCAmelCase__  =   load_tool("""image-question-answering"""					)
								self.tool.setup()
								lowerCAmelCase__  =   load_tool("""image-question-answering"""   ,		remote=UpperCAmelCase_					)




	def      lowercase__							(  self		:  str					)     ->			List[Any]:




								'''simple docstring'''





								lowerCAmelCase__  =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""					)					) / """000000039769.png"""					)
								lowerCAmelCase__  =   self.tool(UpperCAmelCase_   ,		"""How many cats are sleeping on the couch?"""					)
								self.assertEqual(UpperCAmelCase_   ,		"""2"""					)




	def      lowercase__							(  self		:  Dict					)     ->			Any:




								'''simple docstring'''





								lowerCAmelCase__  =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""					)					) / """000000039769.png"""					)
								lowerCAmelCase__  =   self.remote_tool(UpperCAmelCase_   ,		"""How many cats are sleeping on the couch?"""					)
								self.assertEqual(UpperCAmelCase_   ,		"""2"""					)




	def      lowercase__							(  self		:  int					)     ->			List[str]:




								'''simple docstring'''





								lowerCAmelCase__  =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""					)					) / """000000039769.png"""					)
								lowerCAmelCase__  =   self.tool(image=UpperCAmelCase_   ,		question="""How many cats are sleeping on the couch?"""					)
								self.assertEqual(UpperCAmelCase_   ,		"""2"""					)




	def      lowercase__							(  self		:  int					)     ->			List[Any]:




								'''simple docstring'''





								lowerCAmelCase__  =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""					)					) / """000000039769.png"""					)
								lowerCAmelCase__  =   self.remote_tool(image=UpperCAmelCase_   ,		question="""How many cats are sleeping on the couch?"""					)
								self.assertEqual(UpperCAmelCase_   ,		"""2"""					)













"""simple docstring"""





import doctest

import projectq
from projectq.ops import H, Measure






def 							A(    snake_case_						):
       """simple docstring"""





       lowercase__:							Dict         =     quantum_engine.allocate_qubit()
       H | qubit
       Measure | qubit
       return int(snake_case_						)


if __name__ == "__main__":
  doctest.testmod()

  # initialises a new quantum backend
  UpperCamelCase					=     projectq.MainEngine()

  # Generate a list of 10 random numbers
  UpperCamelCase					=     [get_random_number(quantum_engine) for _ in range(10)]

  # Flushes the quantum engine from memory
  quantum_engine.flush()

  print("""Random numbers""", random_numbers_list)






