






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       snake_case_		(     lowerCAmelCase_       :						SplitDict      ):
							__lowercase      :							List[Any]				=     split_dict._to_yaml_list()
							assert len(lowerCAmelCase_      ) == len(lowerCAmelCase_      )
							__lowercase      :							List[Any]				=     SplitDict._from_yaml_list(lowerCAmelCase_      )
							for split_name, split_info in split_dict.items():
														# dataset_name field is deprecated, and is therefore not part of the YAML dump
														__lowercase      :							Optional[Any]				=     None
														# the split name of split_dict takes over the name of the split info object
														__lowercase      :							List[Any]				=     split_name
							assert split_dict == reloaded



@pytest.mark.parametrize(
    """split_info"""       ,       [SplitInfo(), SplitInfo(dataset_name=lowerCAmelCase_      ), SplitInfo(dataset_name="""my_dataset"""      )]      )
def       snake_case_		(     lowerCAmelCase_       :						List[Any]      ):
							# For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
							# field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
							__lowercase      :							Any				=     asdict(SplitDict({"""train""": split_info}      )      )
							assert "dataset_name" in split_dict_asdict["train"]
							assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name







def       snake_case_		(     lowerCAmelCase_       :						int       ,       lowerCAmelCase_       :						int      ):
							return int((input_a, input_a).count(1      ) != 0      )
def       snake_case_		(     ):
							assert or_gate(0       ,       0      ) == 0
							assert or_gate(0       ,       1      ) == 1
							assert or_gate(1       ,       0      ) == 1
							assert or_gate(1       ,       1      ) == 1


if __name__ == "__main__":
	print(or_gate(0, 1))
	print(or_gate(1, 0))
	print(or_gate(0, 0))
	print(or_gate(1, 1))