
'''simple docstring'''
import unittest

from transformers import is_torch_available, load_tool

from .test_tools_common import ToolTesterMixin


if is_torch_available():
						import torch






class      snake_case__    (	unittest.TestCase  , __SCREAMING_SNAKE_CASE ):







		"""simple docstring"""

		def 	lowerCAmelCase							(	self							:       str	)		->       Union[str, Any]:






				"""simple docstring"""







				snake_case   :    Any			       =		load_tool('''speech-to-text'''	)
				self.tool.setup()



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






				"""simple docstring"""







				snake_case   :    List[Any]			       =		self.tool(torch.ones(3000	)	)
				self.assertEqual(UpperCamelCase__   ,     ''' you'''	)



		def 	lowerCAmelCase							(	self							:       Any	)		->       int:






				"""simple docstring"""







				snake_case   :    List[Any]			       =		self.tool(audio=torch.ones(3000	)	)
				self.assertEqual(UpperCamelCase__   ,     ''' you'''	)




'''simple docstring'''
from __future__ import annotations

from collections.abc import Callable




def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__      ,    SCREAMING_SNAKE_CASE__ = 100      ,    )   ->				float:


		'''simple docstring'''


		snake_case   :    int			       =		x_start
		snake_case   :    Tuple			       =		fnc(SCREAMING_SNAKE_CASE__       )
		snake_case   :    Dict			       =		0.0

		for _ in range(SCREAMING_SNAKE_CASE__       ):
				# Approximates small segments of curve as linear and solve
				# for trapezoidal area
				snake_case   :    str			       =		(x_end - x_start) / steps + xa
				snake_case   :    str			       =		fnc(SCREAMING_SNAKE_CASE__       )
				area += abs(fxa + fxa       ) * (xa - xa) / 2

				# Increment step
				snake_case   :    Any			       =		xa
				snake_case   :    List[str]			       =		fxa
		return area


if __name__ == "__main__":




						def 					_UpperCamelCase		(    SCREAMING_SNAKE_CASE__       )   ->				str:


								'''simple docstring'''


								return x**3

						print("f(x) = x^3")
						print("The area between the curve, x = -10, x = 10 and the x axis is:")
						lowercase__		    =	1_0
						while i <= 1_0_0_0_0_0:
												lowercase__		    =	trapezoidal_area(f, -5, 5, i)
												print(f"with {i} steps: {area}")
												i *= 1_0


