


# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import doctest
import sys
import warnings
from os.path import abspath, dirname, join

import _pytest

from transformers.testing_utils import HfDoctestModule, HfDocTestParser


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowerCamelCase__							:						Optional[Any]							     =   abspath(join(dirname(__file__), """src"""))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="""ignore""", category=FutureWarning)







def SCREAMING_SNAKE_CASE	(			__lowerCAmelCase				)    ->				Optional[Any]:
  config.addinivalue_line(
      '''markers'''							,   '''is_pt_tf_cross_test: mark test to run only when PT and TF interactions are tested'''				)
  config.addinivalue_line(
      '''markers'''							,   '''is_pt_flax_cross_test: mark test to run only when PT and FLAX interactions are tested'''				)
  config.addinivalue_line('''markers'''							,   '''is_pipeline_test: mark test to run only when pipelines are tested'''				)
  config.addinivalue_line('''markers'''							,   '''is_staging_test: mark test to run only in the staging environment'''				)
  config.addinivalue_line('''markers'''							,   '''accelerate_tests: mark test that require accelerate'''				)
  config.addinivalue_line('''markers'''							,   '''tool_tests: mark the tool tests that are run on their specific schedule'''				)







def SCREAMING_SNAKE_CASE	(			__lowerCAmelCase				)    ->				Dict:
  from transformers.testing_utils import pytest_addoption_shared

  pytest_addoption_shared(__lowerCAmelCase				)







def SCREAMING_SNAKE_CASE	(			__lowerCAmelCase				)    ->				int:
  from transformers.testing_utils import pytest_terminal_summary_main

  snake_case__						= terminalreporter.config.getoption('''--make-reports'''				)
  if make_reports:
    pytest_terminal_summary_main(__lowerCAmelCase							,   id=__lowerCAmelCase				)







def SCREAMING_SNAKE_CASE	(			__lowerCAmelCase							,   __lowerCAmelCase				)    ->				Dict:
  # If no tests are collected, pytest exists with code 5, which makes the CI fail.
  if exitstatus == 5:
    snake_case__						= 0


# Doctest custom flag to ignore output.
lowerCamelCase__							:						Tuple							     =   doctest.register_optionflag("""IGNORE_RESULT""")

lowerCamelCase__							:						Optional[Any]							     =   doctest.OutputChecker
class 		__magic_name__						(snake_case_				):





     '''simple docstring'''



     def 	SCREAMING_SNAKE_CASE__						(					self:List[str]     ,		_a:Optional[Any]     ,		_a:Optional[int]     ,		_a:Union[str, Any]   ):
       if IGNORE_RESULT & optionflags:
         return True
       return OutputChecker.check_output(self     ,		_a     ,		_a     ,		_a   )




lowerCamelCase__							:						Optional[int]							     =   CustomOutputChecker
lowerCamelCase__							:						Dict							     =   HfDoctestModule


lowerCamelCase__							:						int							     =   HfDocTestParser



"""simple docstring"""






from collections import namedtuple

UpperCAmelCase        =				namedtuple("""from_to""", """from_ to""")

UpperCAmelCase        =				{
    """cubicmeter""": from_to(1, 1),
    """litre""": from_to(0.001, 1_0_0_0),
    """kilolitre""": from_to(1, 1),
    """gallon""": from_to(0.00_454, 264.172),
    """cubicyard""": from_to(0.76_455, 1.30_795),
    """cubicfoot""": from_to(0.028, 35.3_147),
    """cup""": from_to(0.000_236_588, 4_226.75),
}




def __magic_name__	(				_lowerCamelCase:		float,					_lowerCamelCase:		str,					_lowerCamelCase:		str			)					->						float:

	'''simple docstring'''




	if from_type not in METRIC_CONVERSION:
		raise ValueError(
		    F"""Invalid 'from_type' value: {from_type!r}  Supported values are:\n"""
		    + ''', '''.join(_lowerCamelCase			)			)
	if to_type not in METRIC_CONVERSION:
		raise ValueError(
		    F"""Invalid 'to_type' value: {to_type!r}.  Supported values are:\n"""
		    + ''', '''.join(_lowerCamelCase			)			)
	return value * METRIC_CONVERSION[from_type].from_ * METRIC_CONVERSION[to_type].to


if __name__ == "__main__":
					import doctest

					doctest.testmod()


