
"""simple docstring"""



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.
_snake_case          =						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 	__snake_case  (    SCREAMING_SNAKE_CASE:					List[Any]						):






							"""simple docstring"""



							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 	__snake_case  (    SCREAMING_SNAKE_CASE:					str						):






							"""simple docstring"""



							from transformers.testing_utils import pytest_addoption_shared

							pytest_addoption_shared(snake_case__						)






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					Union[str, Any]						):






							"""simple docstring"""



							from transformers.testing_utils import pytest_terminal_summary_main

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






def 	__snake_case  (    SCREAMING_SNAKE_CASE:					Any     ,  SCREAMING_SNAKE_CASE:					Optional[int]						):






							"""simple docstring"""



							if exitstatus == 5:
														_lowerCAmelCase  	=			0


# Doctest custom flag to ignore output.
_snake_case          =						doctest.register_optionflag('''IGNORE_RESULT''')

_snake_case          =						doctest.OutputChecker
class        _SCREAMING_SNAKE_CASE  (  _lowercase							):






				'''simple docstring'''



				def 				__lowerCamelCase	(					self	:			List[str]				,     UpperCAmelCase_	:			Dict				,     UpperCAmelCase_	:			int				,     UpperCAmelCase_	:			Dict  )		->  Tuple:







											"""simple docstring"""




											if IGNORE_RESULT & optionflags:
																		return True
											return OutputChecker.check_output(self				,     A_				,     A_				,     A_  )






_snake_case          =						CustomOutputChecker
_snake_case          =						HfDoctestModule

_snake_case          =						HfDocTestParser








"""simple docstring"""



import pytest


_snake_case          =						'''__dummy_dataset1__'''

_snake_case          =						'''
import json
import os

import datasets


REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/"
URLS = {"train": REPO_URL + "wikiann-bn-train.jsonl", "validation": REPO_URL + "wikiann-bn-validation.jsonl"}


class __DummyDataset1__(datasets.GeneratorBasedBuilder):

    def _info(self):
        features = datasets.Features(
            {
                "tokens": datasets.Sequence(datasets.Value("string")),
                "ner_tags": datasets.Sequence(
                    datasets.features.ClassLabel(
                        names=[
                            "O",
                            "B-PER",
                            "I-PER",
                            "B-ORG",
                            "I-ORG",
                            "B-LOC",
                            "I-LOC",
                        ]
                    )
                ),
                "langs": datasets.Sequence(datasets.Value("string")),
                "spans": datasets.Sequence(datasets.Value("string")),
            }
        )
        return datasets.DatasetInfo(features=features)

    def _split_generators(self, dl_manager):
        dl_path = dl_manager.download(URLS)
        return [
            datasets.SplitGenerator(datasets.Split.TRAIN, gen_kwargs={"filepath": dl_path["train"]}),
            datasets.SplitGenerator(datasets.Split.VALIDATION, gen_kwargs={"filepath": dl_path["validation"]}),
        ]

    def _generate_examples(self, filepath):
        with open(filepath, "r", encoding="utf-8") as f:
            for i, line in enumerate(f):
                yield i, json.loads(line)
'''






@pytest.fixture
def 	__snake_case  (    ):






							"""simple docstring"""



							return DATASET_LOADING_SCRIPT_NAME






@pytest.fixture
def 	__snake_case  (    ):






							"""simple docstring"""



							return DATASET_LOADING_SCRIPT_CODE






@pytest.fixture
def 	__snake_case  (    SCREAMING_SNAKE_CASE:					List[str]     ,  SCREAMING_SNAKE_CASE:					Optional[int]     ,  SCREAMING_SNAKE_CASE:					List[str]						):






							"""simple docstring"""



							_lowerCAmelCase  	=			dataset_loading_script_name
							_lowerCAmelCase  	=			tmp_path / 'datasets' / script_name
							script_dir.mkdir(parents=SCREAMING_SNAKE_CASE						)
							_lowerCAmelCase  	=			script_dir / f"""{script_name}.py"""
							with open(SCREAMING_SNAKE_CASE     ,  'w'						) as f:
														f.write(SCREAMING_SNAKE_CASE						)
							return str(SCREAMING_SNAKE_CASE						)






