




import pytest

import datasets


# Import fixture modules as plugins
snake_case_ : Tuple    		=       ["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"]


def    A						(__A   :    Optional[int]   ,				__A   :    Any       )   ->      Optional[int]:







     """simple docstring"""


     for item in items:
          if any(marker in item.keywords for marker in ['''integration''', '''unit''']       ):
               continue
          item.add_marker(pytest.mark.unit       )


def    A						(__A   :    Optional[Any]       )   ->      Optional[int]:







     """simple docstring"""


     config.addinivalue_line('''markers'''   ,				'''torchaudio_latest: mark test to run with torchaudio>=0.12'''       )


@pytest.fixture(autouse=__A       )
def    A						(__A   :    Optional[int]   ,				__A   :    Dict       )   ->      List[Any]:







     """simple docstring"""


     UpperCAmelCase_          =							tmp_path_factory.getbasetemp() / '''cache'''
     UpperCAmelCase_          =							test_hf_cache_home / '''datasets'''
     UpperCAmelCase_          =							test_hf_cache_home / '''metrics'''
     UpperCAmelCase_          =							test_hf_cache_home / '''modules'''
     monkeypatch.setattr('''datasets.config.HF_DATASETS_CACHE'''   ,				str(__A       )       )
     monkeypatch.setattr('''datasets.config.HF_METRICS_CACHE'''   ,				str(__A       )       )
     monkeypatch.setattr('''datasets.config.HF_MODULES_CACHE'''   ,				str(__A       )       )
     UpperCAmelCase_          =							test_hf_datasets_cache / '''downloads'''
     monkeypatch.setattr('''datasets.config.DOWNLOADED_DATASETS_PATH'''   ,				str(__A       )       )
     UpperCAmelCase_          =							test_hf_datasets_cache / '''downloads''' / '''extracted'''
     monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH'''   ,				str(__A       )       )


@pytest.fixture(autouse=__A   ,				scope='''session'''       )
def    A						()   ->      Dict:







     """simple docstring"""


     datasets.disable_progress_bar()


@pytest.fixture(autouse=__A       )
def    A						(__A   :    Tuple       )   ->      str:







     """simple docstring"""


     monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'''   ,				__A       )


@pytest.fixture
def    A						(__A   :    Union[str, Any]       )   ->      int:







     """simple docstring"""


     monkeypatch.setattr('''sqlalchemy.util.deprecations.SILENCE_UBER_WARNING'''   ,				__A       )














import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
 import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin





@require_torch
class 			__a  (    unittest.TestCase       ,   A__       ):







 def 					__lowercase					(		self					:   Any						):


      '''simple docstring'''






      UpperCamelCase__			:   Dict       				=  load_tool("text-to-speech"						)
      self.tool.setup()







 def 					__lowercase					(		self					:   Union[str, Any]						):


      '''simple docstring'''






      torch.manual_seed(0						)
      UpperCamelCase__			:   Union[str, Any]       				=  self.tool("hey"						)
      UpperCamelCase__			:   Any       				=  result.to_raw()
      self.assertTrue(
          torch.allclose(
              resulting_tensor[:3]							,   torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]						)							,   )						)







 def 					__lowercase					(		self					:   List[Any]						):


      '''simple docstring'''






      torch.manual_seed(0						)
      UpperCamelCase__			:   List[Any]       				=  self.tool("hey"						)
      UpperCamelCase__			:   int       				=  result.to_raw()
      self.assertTrue(
          torch.allclose(
              resulting_tensor[:3]							,   torch.tensor([-0.0_0_0_5_9_6_6_6_6_8_8_3_2_1_1_5_8_2_9, -0.0_0_0_3_6_5_7_6_4_0_1_9_0_7_9_5_0_6_4, -0.0_0_0_1_3_4_3_9_5_0_2_7_9_9_8_8_3_4_8_5]						)							,   )						)