def generate_datasets(spec_path): try: generator = \ GeneratorsHandler(arguments={'config_file': spec_path}) for dset_name, dset_format, dset_path in generator.generate(): click.echo("| Finished!\n" f"| Dataset name: {dset_name}\n" f"| Dataset format: {dset_format}\n" f"| Dataset: {dset_path}\n") except Exception as err: click.echo(f"Error: {err}")
def test_generate(self, mocker, valid_specification): mock_write = mocker.patch \ .object(GeneratorsHandler, 'write_dataframe') mock_write.return_value = 'file_path' mock_config = mocker.patch \ .object(GeneratorsHandler, 'valid_specification_dataset') mock_config.return_value = valid_specification handler = GeneratorsHandler(arguments={'config_file': None}) for key, format_, path in handler.generate(): assert key is not None assert isinstance(key, str) assert format_ is not None assert isinstance(format_, str) assert path is not None assert isinstance(path, str) mock_write.assert_called()