






'''simple docstring'''



import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict



@pytest.mark.parametrize(
    'split_dict',       [
        SplitDict(),
        SplitDict({'train': SplitInfo(name='train',       num_bytes=1337,       num_examples=42,       dataset_name='my_dataset'     )}     ),
        SplitDict({'train': SplitInfo(name='train',       num_bytes=1337,       num_examples=42     )}     ),
        SplitDict({'train': SplitInfo()}     ),
    ],       )
def  __UpperCAmelCase						(					SCREAMING_SNAKE_CASE__:						SplitDict     )	->      Any:

   """simple docstring"""
   __a					  =     split_dict._to_yaml_list()
   assert len(a__     ) == len(a__     )
   __a					  =     SplitDict._from_yaml_list(a__     )
   for split_name, split_info in split_dict.items():
      # dataset_name field is deprecated, and is therefore not part of the YAML dump
      __a					  =     None
      # the split name of split_dict takes over the name of the split info object
      __a					  =     split_name
   assert split_dict == reloaded



@pytest.mark.parametrize(
    'split_info',       [SplitInfo(), SplitInfo(dataset_name=a__     ), SplitInfo(dataset_name='my_dataset'     )]     )
def  __UpperCAmelCase						(					SCREAMING_SNAKE_CASE__:						List[str]     )	->      List[Any]:

   """simple docstring"""
   __a					  =     asdict(SplitDict({'train': split_info}     )     )
   assert "dataset_name" in split_dict_asdict["train"]
   assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name



from .imports import is_rich_available


if is_rich_available():
		from rich.traceback import install

		install(show_locals=False)

else:
		raise ModuleNotFoundError('''To use the rich extension, install rich with `pip install rich`''')
