




'''simple docstring'''




import pytest

import datasets


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





def 	a_				( __snake_case				:     Optional[Any]  ,			__snake_case				:     str  )				->		str:



       """simple docstring"""
       # Mark tests as "unit" by default if not marked as "integration" (or already marked as "unit")
       for item in items:
              if any(marker in item.keywords for marker in ['''integration''', '''unit''']  ):
                     continue
              item.add_marker(pytest.mark.unit  )





def 	a_				( __snake_case				:     List[Any]  )				->		Any:



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





@pytest.fixture(autouse=lowerCAmelCase__  )
def 	a_				( __snake_case				:     Optional[Any]  ,			__snake_case				:     Dict  )				->		List[str]:



       """simple docstring"""
       lowerCamelCase_				=tmp_path_factory.getbasetemp() / "cache"
       lowerCamelCase_				=test_hf_cache_home / "datasets"
       lowerCamelCase_				=test_hf_cache_home / "metrics"
       lowerCamelCase_				=test_hf_cache_home / "modules"
       monkeypatch.setattr('''datasets.config.HF_DATASETS_CACHE'''  ,			str(lowerCAmelCase__  )  )
       monkeypatch.setattr('''datasets.config.HF_METRICS_CACHE'''  ,			str(lowerCAmelCase__  )  )
       monkeypatch.setattr('''datasets.config.HF_MODULES_CACHE'''  ,			str(lowerCAmelCase__  )  )
       lowerCamelCase_				=test_hf_datasets_cache / "downloads"
       monkeypatch.setattr('''datasets.config.DOWNLOADED_DATASETS_PATH'''  ,			str(lowerCAmelCase__  )  )
       lowerCamelCase_				=test_hf_datasets_cache / "downloads" / "extracted"
       monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH'''  ,			str(lowerCAmelCase__  )  )





@pytest.fixture(autouse=lowerCAmelCase__  ,			scope='''session'''  )
def 	a_				( )				->		Union[str, Any]:



       """simple docstring"""
       datasets.disable_progress_bar()





@pytest.fixture(autouse=lowerCAmelCase__  )
def 	a_				( __snake_case				:     Union[str, Any]  )				->		Optional[Any]:



       """simple docstring"""
       monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'''  ,			lowerCAmelCase__  )





@pytest.fixture
def 	a_				( __snake_case				:     Optional[Any]  )				->		str:



       """simple docstring"""
       monkeypatch.setattr('''sqlalchemy.util.deprecations.SILENCE_UBER_WARNING'''  ,			lowerCAmelCase__  )











"""simple docstring"""






import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin



class 					__UpperCAmelCase							(						unittest.TestCase						,  _UpperCamelCase  ):
				def       UpperCAmelCase      (		self    :			Dict    )	->	List[Any]:



							'''simple docstring'''



							a__  :	Any		 =			load_tool("text-classification"    )
							self.tool.setup()
							a__  :	List[Any]		 =			load_tool("text-classification"	, remote=a_    )
				def       UpperCAmelCase      (		self    :			Optional[int]    )	->	Optional[Any]:



							'''simple docstring'''



							a__  :	str		 =			self.tool("That's quite cool"	, ["positive", "negative"]    )
							self.assertEqual(a_	, "positive"    )
				def       UpperCAmelCase      (		self    :			Union[str, Any]    )	->	Optional[int]:



							'''simple docstring'''



							a__  :	List[str]		 =			self.remote_tool("That's quite cool"	, ["positive", "negative"]    )
							self.assertEqual(a_	, "positive"    )
				def       UpperCAmelCase      (		self    :			Dict    )	->	Any:



							'''simple docstring'''



							a__  :	List[str]		 =			self.tool(text="That's quite cool"	, labels=["positive", "negative"]    )
							self.assertEqual(a_	, "positive"    )






				def       UpperCAmelCase      (		self    :			List[Any]    )	->	List[Any]:



							'''simple docstring'''



							a__  :	Tuple		 =			self.remote_tool(text="That's quite cool"	, labels=["positive", "negative"]    )
							self.assertEqual(a_	, "positive"    )