code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def test_from_correct_config_versioned_warn(
self, caplog, correct_config, versioned
):
"""Check the warning if `version` attribute was added
to the dataset config"""
correct_config["catalog"]["boats"]["versioned"] = versioned
correct_config["catalog"]["boats"]["version"] = T... | Check the warning if `version` attribute was added
to the dataset config | test_from_correct_config_versioned_warn | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_load_version(self, correct_config, dummy_dataframe, mocker):
"""Test load versioned datasets from config"""
new_dataframe = pd.DataFrame({"col1": [0, 0], "col2": [0, 0], "col3": [0, 0]})
correct_config["catalog"]["boats"]["versioned"] = True
mocker.patch(
"kedro.io.d... | Test load versioned datasets from config | test_load_version | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_no_versions_with_cloud_protocol(self, monkeypatch):
"""Check the error if no versions are available for load from cloud storage"""
monkeypatch.setenv("AWS_ACCESS_KEY_ID", "dummmy")
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "dummmy")
version = Version(load=None, save=None)
... | Check the error if no versions are available for load from cloud storage | test_no_versions_with_cloud_protocol | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_redefine_save_version_via_catalog(self, correct_config, dataset_versioned):
"""Test redefining save version when it is already set"""
# Version is set automatically for the catalog
catalog = DataCatalog.from_config(**correct_config)
with pytest.raises(VersionAlreadyExistsError):... | Test redefining save version when it is already set | test_redefine_save_version_via_catalog | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_set_load_and_save_versions(self, correct_config, dataset_versioned):
"""Test setting load and save versions for catalog based on dataset's versions provided"""
catalog = DataCatalog(datasets={"ds_versioned": dataset_versioned})
assert catalog._load_versions["ds_versioned"] == dataset_v... | Test setting load and save versions for catalog based on dataset's versions provided | test_set_load_and_save_versions | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_set_same_versions(self, correct_config, dataset_versioned):
"""Test setting the same load and save versions for catalog based on dataset's versions provided"""
catalog = DataCatalog(datasets={"ds_versioned": dataset_versioned})
catalog.add("ds_same_versions", dataset_versioned)
... | Test setting the same load and save versions for catalog based on dataset's versions provided | test_set_same_versions | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_redefine_save_version_with_cached_dataset(
self, correct_config, cached_dataset_versioned
):
"""Test redefining load and save version with CachedDataset"""
catalog = DataCatalog.from_config(**correct_config)
# Redefining save version fails
with pytest.raises(Version... | Test redefining load and save version with CachedDataset | test_redefine_save_version_with_cached_dataset | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_match_added_to_datasets_on_get(self, config_with_dataset_factories):
"""Check that the datasets that match patterns are only added when fetched"""
catalog = DataCatalog.from_config(**config_with_dataset_factories)
assert "{brand}_cars" not in catalog._datasets
assert "tesla_cars... | Check that the datasets that match patterns are only added when fetched | test_match_added_to_datasets_on_get | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_exists_in_catalog_config(
self, config_with_dataset_factories, dataset_name, expected
):
"""Check that the dataset exists in catalog when it matches a pattern
or is in the catalog"""
catalog = DataCatalog.from_config(**config_with_dataset_factories)
assert (dataset_n... | Check that the dataset exists in catalog when it matches a pattern
or is in the catalog | test_exists_in_catalog_config | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_patterns_not_in_catalog_datasets(self, config_with_dataset_factories):
"""Check that the pattern is not in the catalog datasets"""
catalog = DataCatalog.from_config(**config_with_dataset_factories)
assert "audi_cars" in catalog._datasets
assert "{brand}_cars" not in catalog._dat... | Check that the pattern is not in the catalog datasets | test_patterns_not_in_catalog_datasets | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_explicit_entry_not_overwritten(self, config_with_dataset_factories):
"""Check that the existing catalog entry is not overwritten by config in pattern"""
catalog = DataCatalog.from_config(**config_with_dataset_factories)
audi_cars = catalog._get_dataset("audi_cars")
assert isinst... | Check that the existing catalog entry is not overwritten by config in pattern | test_explicit_entry_not_overwritten | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_dataset_not_in_catalog_when_no_pattern_match(
self, config_with_dataset_factories, dataset_name, pattern
):
"""Check that the dataset is not added to the catalog when there is no pattern"""
catalog = DataCatalog.from_config(**config_with_dataset_factories)
with pytest.raises... | Check that the dataset is not added to the catalog when there is no pattern | test_dataset_not_in_catalog_when_no_pattern_match | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_sorting_order_patterns(self, config_with_dataset_factories_only_patterns):
"""Check that the sorted order of the patterns is correct according
to parsing rules"""
catalog = DataCatalog.from_config(**config_with_dataset_factories_only_patterns)
sorted_keys_expected = [
... | Check that the sorted order of the patterns is correct according
to parsing rules | test_sorting_order_patterns | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_multiple_catch_all_patterns_not_allowed(
self, config_with_dataset_factories
):
"""Check that multiple catch-all patterns are not allowed"""
config_with_dataset_factories["catalog"]["{default1}"] = {
"filepath": "data/01_raw/{default1}.csv",
"type": "pandas.C... | Check that multiple catch-all patterns are not allowed | test_multiple_catch_all_patterns_not_allowed | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_sorting_order_with_other_dataset_through_extra_pattern(
self, config_with_dataset_factories_only_patterns_no_default
):
"""Check that the sorted order of the patterns is correct according to parsing rules when a default dataset
is added through extra patterns (this would happen via ... | Check that the sorted order of the patterns is correct according to parsing rules when a default dataset
is added through extra patterns (this would happen via the runner) and user default is not present | test_sorting_order_with_other_dataset_through_extra_pattern | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_user_default_overwrites_runner_default(self):
"""Check that the user default overwrites the runner default when both are present"""
catalog_config = {
"{dataset}s": {
"type": "pandas.CSVDataset",
"filepath": "data/01_raw/{dataset}s.csv",
}... | Check that the user default overwrites the runner default when both are present | test_user_default_overwrites_runner_default | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_default_dataset(self, config_with_dataset_factories_with_default, caplog):
"""Check that default dataset is used when no other pattern matches"""
catalog = DataCatalog.from_config(**config_with_dataset_factories_with_default)
assert "jet@planes" not in catalog._datasets
jet_data... | Check that default dataset is used when no other pattern matches | test_default_dataset | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_unmatched_key_error_when_parsing_config(
self, config_with_dataset_factories_bad_pattern
):
"""Check error raised when key mentioned in the config is not in pattern name"""
pattern = (
"Incorrect dataset configuration provided. Keys used in the configuration {'{brand}'} ... | Check error raised when key mentioned in the config is not in pattern name | test_unmatched_key_error_when_parsing_config | python | kedro-org/kedro | tests/io/test_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_data_catalog.py | Apache-2.0 |
def test_catalog_filter_regex(
self, multi_catalog, name_regex, type_regex, expected
):
"""Test that regex patterns filter materialized datasets accordingly"""
assert (
multi_catalog.filter(name_regex=name_regex, type_regex=type_regex)
== expected
) | Test that regex patterns filter materialized datasets accordingly | test_catalog_filter_regex | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_from_config_catalog_filter_regex(
self, data_catalog_from_config, name_regex, type_regex, by_type, expected
):
"""Test that regex patterns filter lazy and materialized datasets accordingly"""
data_catalog_from_config["materialized"] = ParquetDataset(filepath="xyz.parq")
asse... | Test that regex patterns filter lazy and materialized datasets accordingly | test_from_config_catalog_filter_regex | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_init_with_raw_data(self, dummy_dataframe, dataset):
"""Test catalog initialisation with raw data"""
catalog = KedroDataCatalog(
datasets={"ds": dataset}, raw_data={"df": dummy_dataframe}
)
assert "ds" in catalog
assert "df" in catalog
assert isinstanc... | Test catalog initialisation with raw data | test_init_with_raw_data | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_missing_keys_from_load_versions(self, correct_config):
"""Test load versions include keys missing in the catalog"""
pattern = "'load_versions' keys [version] are not found in the catalog."
with pytest.raises(DatasetNotFoundError, match=re.escape(pattern)):
KedroDataCatalog.f... | Test load versions include keys missing in the catalog | test_missing_keys_from_load_versions | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_get_dataset_matching_pattern(self, data_catalog):
"""Test get_dataset() when dataset is not in the catalog but pattern matches"""
match_pattern_ds = "match_pattern_ds"
assert match_pattern_ds not in data_catalog
data_catalog.config_resolver.add_runtime_patterns(
{"{d... | Test get_dataset() when dataset is not in the catalog but pattern matches | test_get_dataset_matching_pattern | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_dataset_property(self, data_catalog_from_config):
"""Test _dataset attribute returns the same result as dataset property"""
# Catalog includes only lazy dataset, we get boats dataset to materialize it
_ = data_catalog_from_config["boats"]
assert data_catalog_from_config.datasets... | Test _dataset attribute returns the same result as dataset property | test_dataset_property | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_config_missing_type(self, correct_config):
"""Check the error if type attribute is missing for some dataset(s)
in the config"""
del correct_config["catalog"]["boats"]["type"]
pattern = (
"An exception occurred when parsing config for dataset 'boat... | Check the error if type attribute is missing for some dataset(s)
in the config | test_config_missing_type | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_validate_dataset_config(self):
"""Test _validate_dataset_config raises error when wrong dataset config type is passed"""
pattern = (
"Catalog entry 'bad' is not a valid dataset configuration. \n"
"Hint: If this catalog entry is intended for variable inter... | Test _validate_dataset_config raises error when wrong dataset config type is passed | test_validate_dataset_config | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_bad_confirm(self, correct_config, dataset_name, pattern):
"""Test confirming non existent dataset or the one that
does not have `confirm` method"""
data_catalog = KedroDataCatalog.from_config(**correct_config)
with pytest.raises(DatasetError, match=re.escape(patt... | Test confirming non existent dataset or the one that
does not have `confirm` method | test_bad_confirm | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_iteration(self, correct_config):
"""Test iterate through keys, values and items."""
data_catalog = KedroDataCatalog.from_config(**correct_config)
for ds_name_cat, ds_name_config in zip(
data_catalog, correct_config["catalog"]
):
a... | Test iterate through keys, values and items. | test_iteration | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_from_correct_config_versioned_warn(
self, caplog, correct_config, versioned
):
"""Check the warning if `version` attribute was added
to the dataset config"""
correct_config["catalog"]["boats"]["versioned"] = versioned
correct_config["catalog"]... | Check the warning if `version` attribute was added
to the dataset config | test_from_correct_config_versioned_warn | python | kedro-org/kedro | tests/io/test_kedro_data_catalog.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_kedro_data_catalog.py | Apache-2.0 |
def test_load_invocation(self, mocker):
"""Test the basic `load` method invocation"""
mocked_load = mocker.Mock(return_value=42)
dataset = LambdaDataset(mocked_load, None)
result = dataset.load()
mocked_load.assert_called_once_with()
assert result == 42 | Test the basic `load` method invocation | test_load_invocation | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_load_raises_error(self):
"""Check the error if loading the LambdaDataset raises an exception"""
error_message = "Internal load exception message"
def internal_load():
raise FileNotFoundError(error_message)
dataset = LambdaDataset(internal_load, None)
with p... | Check the error if loading the LambdaDataset raises an exception | test_load_raises_error | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_save_raises_error(self, mocked_save, mocked_dataset):
"""Check the error if saving the LambdaDataset raises an exception"""
error_message = "Cannot save to an existing file"
mocked_save.side_effect = FileExistsError(error_message)
pattern = (
r"Failed while saving d... | Check the error if saving the LambdaDataset raises an exception | test_save_raises_error | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_save_none(self, mocked_save, mocked_dataset):
"""Check the error when passing None to `save` call"""
pattern = "Saving 'None' to a 'Dataset' is not allowed"
with pytest.raises(DatasetError, match=pattern):
mocked_dataset.save(None)
assert mocked_save.called == 0 | Check the error when passing None to `save` call | test_save_none | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_exists_invocation(self, mocker):
"""Test the basic `exists` method invocation"""
mocked_exists = mocker.Mock(return_value=True)
dataset = LambdaDataset(None, None, mocked_exists)
result = dataset.exists()
mocked_exists.assert_called_once_with()
assert result is T... | Test the basic `exists` method invocation | test_exists_invocation | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_exists_not_implemented(self):
"""Check that `exists` method returns False by default"""
dataset = LambdaDataset(None, None)
assert not dataset.exists() | Check that `exists` method returns False by default | test_exists_not_implemented | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_exists_raises_error(self, mocker):
"""Check the error when `exists` raises an exception"""
mocked_exists = mocker.Mock()
error_message = "File not found"
mocked_exists.side_effect = FileNotFoundError(error_message)
dataset = LambdaDataset(None, None, mocked_exists)
... | Check the error when `exists` raises an exception | test_exists_raises_error | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_release_invocation(self, mocker):
"""Test the basic `release` method invocation"""
mocked_release = mocker.Mock()
dataset = LambdaDataset(None, None, None, mocked_release)
dataset.release()
mocked_release.assert_called_once_with() | Test the basic `release` method invocation | test_release_invocation | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_release_raises_error(self, mocker):
"""Check the error when `release` raises an exception"""
mocked_release = mocker.Mock()
error_message = "File not found"
mocked_release.side_effect = FileNotFoundError(error_message)
dataset = LambdaDataset(None, None, None, mocked_rel... | Check the error when `release` raises an exception | test_release_raises_error | python | kedro-org/kedro | tests/io/test_lambda_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_lambda_dataset.py | Apache-2.0 |
def test_load_modify_original_data(self, memory_dataset, input_data):
"""Check that the dataset object is not updated when the original
object is changed."""
input_data = _update_data(input_data, 1, 1, -5)
assert not _check_equals(memory_dataset.load(), input_data) | Check that the dataset object is not updated when the original
object is changed. | test_load_modify_original_data | python | kedro-org/kedro | tests/io/test_memory_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_memory_dataset.py | Apache-2.0 |
def test_load_returns_new_object(self, memory_dataset, input_data):
"""Test that consecutive loads point to different objects in case of a
pandas DataFrame and numpy array"""
loaded_data = memory_dataset.load()
reloaded_data = memory_dataset.load()
assert _check_equals(loaded_dat... | Test that consecutive loads point to different objects in case of a
pandas DataFrame and numpy array | test_load_returns_new_object | python | kedro-org/kedro | tests/io/test_memory_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_memory_dataset.py | Apache-2.0 |
def test_loading_none(self):
"""Check the error when attempting to load the dataset that doesn't
contain any data"""
pattern = r"Data for MemoryDataset has not been saved yet\."
with pytest.raises(DatasetError, match=pattern):
MemoryDataset().load() | Check the error when attempting to load the dataset that doesn't
contain any data | test_loading_none | python | kedro-org/kedro | tests/io/test_memory_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_memory_dataset.py | Apache-2.0 |
def test_exists(self, shared_memory_dataset, input_data):
"""Check that exists returns the expected values"""
assert not shared_memory_dataset.exists()
shared_memory_dataset.save(input_data)
assert shared_memory_dataset.exists() | Check that exists returns the expected values | test_exists | python | kedro-org/kedro | tests/io/test_shared_memory_dataset.py | https://github.com/kedro-org/kedro/blob/master/tests/io/test_shared_memory_dataset.py | Apache-2.0 |
def dummy_function(dummy_input, my_input):
"""
Returns True if input is not
"""
# this is an in-line comment in the body of the function
random_assignment = "Added for a longer function"
random_assignment += "make sure to modify variable"
return not dummy_input |
Returns True if input is not
| dummy_function | python | kedro-org/kedro | tests/ipython/dummy_function_fixtures.py | https://github.com/kedro-org/kedro/blob/master/tests/ipython/dummy_function_fixtures.py | Apache-2.0 |
def test_transform_dataset_names(self):
"""
Rename some datasets, test string, list and dict formats.
"""
raw_pipeline = pipeline(
[
node(identity, "A", "B", name="node1"),
node(biconcat, ["C", "D"], ["E", "F"], name="node2"),
n... |
Rename some datasets, test string, list and dict formats.
| test_transform_dataset_names | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_prefix_dataset_names(self):
"""
Simple prefixing for dataset of all formats: str, list and dict
"""
raw_pipeline = pipeline(
[
node(identity, "A", "B", name="node1"),
node(biconcat, ["C", "D"], ["E", "F"], name="node2"),
... |
Simple prefixing for dataset of all formats: str, list and dict
| test_prefix_dataset_names | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_prefixing_and_renaming(self):
"""
Prefixing and renaming at the same time.
Explicitly renamed datasets should not be prefixed anymore.
"""
raw_pipeline = pipeline([node(biconcat, ["C", "D"], ["E", "F"])])
resulting_pipeline = pipeline(
raw_pipeline,
... |
Prefixing and renaming at the same time.
Explicitly renamed datasets should not be prefixed anymore.
| test_prefixing_and_renaming | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_transform_params_prefix_and_parameters(self):
"""
Test that transform should prefix all parameters by default.
"""
raw_pipeline = pipeline(
[
node(identity, "parameters", "params:B", name="node1"),
node(biconcat, ["params:C", "D"], ["p... |
Test that transform should prefix all parameters by default.
| test_transform_params_prefix_and_parameters | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_node_properties_preserved(self):
"""
Check that we don't loose any valuable properties on node cloning.
Also an explicitly defined name should get prefixed.
"""
raw_pipeline = pipeline([node(identity, "A", "B", name="node1", tags=["tag1"])])
resulting_pipeline = ... |
Check that we don't loose any valuable properties on node cloning.
Also an explicitly defined name should get prefixed.
| test_node_properties_preserved | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_default_node_name_is_namespaced(self):
"""Check that auto-generated node names are also namespaced"""
raw_pipeline = pipeline([node(identity, "A", "B")])
first_layer_nested_pipe = pipeline(raw_pipeline, namespace="PREFIX")
resulting_node = first_layer_nested_pipe.nodes[0]
... | Check that auto-generated node names are also namespaced | test_default_node_name_is_namespaced | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_expose_intermediate_output(self):
"""Check that we don't namespace an intermediary dataset, anywhere it
is used - either input or output"""
raw_pipeline = pipeline(
[
node(identity, "A", "B", name="node1"),
node(identity, "B", "C", name="node2... | Check that we don't namespace an intermediary dataset, anywhere it
is used - either input or output | test_expose_intermediate_output | python | kedro-org/kedro | tests/pipeline/test_modular_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_modular_pipeline.py | Apache-2.0 |
def test_valid_nodes(valid_nodes_with_inputs):
"""Check if node.run works as expected."""
for node_, input_ in valid_nodes_with_inputs:
output = node_.run(input_)
assert output["dsOut"] == 42 | Check if node.run works as expected. | test_valid_nodes | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_run_got_dataframe(mocked_dataset):
"""Check an exception when non-dictionary (class object) is passed."""
pattern = r"Node.run\(\) expects a dictionary or None, "
pattern += r"but got <class \'kedro.io.lambda_dataset.LambdaDataset\'> instead"
with pytest.raises(ValueError, match=pattern):
... | Check an exception when non-dictionary (class object) is passed. | test_run_got_dataframe | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_unresolved(self):
"""Pass no input when one is expected."""
with pytest.raises(ValueError, match=r"expected one input"):
node(one_in_one_out, "unresolved", "ds1").run(None) | Pass no input when one is expected. | test_unresolved | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_no_inputs_node_error(self, mocked_dataset):
"""Pass one input when none is expected."""
with pytest.raises(ValueError, match=r"expected no inputs"):
node(lambda: 1, None, "A").run({"unexpected": mocked_dataset}) | Pass one input when none is expected. | test_no_inputs_node_error | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_run_diff_size_lists(self, mocked_dataset):
"""Pass only one dict input when two (list) are expected."""
pattern = r"expected 2 input\(s\) \['ds1', 'ds2'\], but "
pattern += r"got the following 1 input\(s\) instead."
with pytest.raises(ValueError, match=pattern):
node... | Pass only one dict input when two (list) are expected. | test_run_diff_size_lists | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_run_diff_size_list_dict(self, mocked_dataset):
"""Pass two dict inputs when one (list) are expected."""
pattern = r"expected 1 input\(s\) \['ds1'\], but got the "
pattern += r"following 2 input\(s\) instead: \['ds1', 'ds2'\]\."
with pytest.raises(ValueError, match=pattern):
... | Pass two dict inputs when one (list) are expected. | test_run_diff_size_list_dict | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_run_list_dict_unavailable(self, mocked_dataset):
"""Pass one dict which is different from expected."""
pattern = r"expected 1 input\(s\) \['ds1'\], but got the "
pattern += r"following 1 input\(s\) instead: \['ds2'\]\."
with pytest.raises(ValueError, match=pattern):
... | Pass one dict which is different from expected. | test_run_list_dict_unavailable | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def test_run_dict_diff_size(self, mocked_dataset):
"""Pass two dict inputs when one is expected."""
pattern = r"expected 1 input\(s\) \['ds1'\], but got the "
pattern += r"following 2 input\(s\) instead: \['ds1', 'ds2'\]\."
with pytest.raises(ValueError, match=pattern):
node(... | Pass two dict inputs when one is expected. | test_run_dict_diff_size | python | kedro-org/kedro | tests/pipeline/test_node_run.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_node_run.py | Apache-2.0 |
def branchless_pipeline():
"""
Fixture for a branchless pipeline configuration.
This fixture defines a branchless pipeline with nodes and their connections.
The pipeline starts with a constant output node A and is followed by a series
of identity nodes in a linear chain from A to E.
Returns:
... |
Fixture for a branchless pipeline configuration.
This fixture defines a branchless pipeline with nodes and their connections.
The pipeline starts with a constant output node A and is followed by a series
of identity nodes in a linear chain from A to E.
Returns:
dict: A dictionary containi... | branchless_pipeline | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def pipeline_list_with_lists():
"""
Fixture for a pipeline configuration with nodes and their connections.
There is added complexity as some nodes map to/from a list of nodes.
Returns:
dict: A dictionary containing the pipeline configuration.
"""
pipeline = {
"nodes": [
... |
Fixture for a pipeline configuration with nodes and their connections.
There is added complexity as some nodes map to/from a list of nodes.
Returns:
dict: A dictionary containing the pipeline configuration.
| pipeline_list_with_lists | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def pipeline_with_dicts():
"""
Fixture for a pipeline configuration with nodes and their connections.
There is added complexity as some nodes map to/from a dictionary of nodes.
Returns:
dict: A dictionary containing the pipeline configuration.
"""
pipeline = {
"nodes": [
... |
Fixture for a pipeline configuration with nodes and their connections.
There is added complexity as some nodes map to/from a dictionary of nodes.
Returns:
dict: A dictionary containing the pipeline configuration.
| pipeline_with_dicts | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def free_input_needed_pipeline():
"""
Fixture for a pipeline configuration with nodes requiring a free input.
The first node ('node1') requires a free input 'A'. The other nodes are
connected in succession.
Returns:
dict: A dictionary containing the pipeline configuration.
"""
pipe... |
Fixture for a pipeline configuration with nodes requiring a free input.
The first node ('node1') requires a free input 'A'. The other nodes are
connected in succession.
Returns:
dict: A dictionary containing the pipeline configuration.
| free_input_needed_pipeline | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def disjoint_pipeline():
"""
Fixture for a pipeline configuration made up of two disjoint pipelines.
Returns:
dict: A dictionary containing the pipeline configuration.
"""
pipeline = {
"nodes": [
node(identity, "A", "B", name="node1"),
node(identity, "B", "C"... |
Fixture for a pipeline configuration made up of two disjoint pipelines.
Returns:
dict: A dictionary containing the pipeline configuration.
| disjoint_pipeline | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def pipeline_input_duplicated():
"""
This fixture defines a pipeline configuration with nodes where the first node ('node1')
has a duplicated input 'A'. The other nodes are connected in succession.
Returns:
dict: A dictionary containing the pipeline configuration.
"""
pipeline = {
... |
This fixture defines a pipeline configuration with nodes where the first node ('node1')
has a duplicated input 'A'. The other nodes are connected in succession.
Returns:
dict: A dictionary containing the pipeline configuration.
| pipeline_input_duplicated | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def str_node_inputs_list():
"""
Fixture for a pipeline configuration with nodes that specify input and output lists.
This fixture defines a pipeline configuration with nodes that specify input and output lists.
The nodes are connected sequentially, and specific inputs and outputs are defined for each n... |
Fixture for a pipeline configuration with nodes that specify input and output lists.
This fixture defines a pipeline configuration with nodes that specify input and output lists.
The nodes are connected sequentially, and specific inputs and outputs are defined for each node.
Returns:
dict: A ... | str_node_inputs_list | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_grouped_nodes(self, all_pipeline_input_data):
"""Check if grouped_nodes func groups the nodes correctly"""
nodes_input = all_pipeline_input_data["nodes"]
expected = all_pipeline_input_data["expected"]
test_pipeline = pipeline(nodes_input)
grouped = test_pipeline.grouped... | Check if grouped_nodes func groups the nodes correctly | test_grouped_nodes | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_node_grouping_by_namespace_name_type(
self, request, pipeline_name, expected
):
"""Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': '... | Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespace_name',
'type': 'namespace' or 'node',
... | test_node_grouping_by_namespace_name_type | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_node_grouping_by_namespace_nodes(self, request, pipeline_name, expected):
"""Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespac... | Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespace_name',
'type': 'namespace' or 'node',
... | test_node_grouping_by_namespace_nodes | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_node_grouping_by_namespace_nested(self, request):
"""Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespace_name',
... | Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespace_name',
'type': 'namespace' or 'node',
... | test_node_grouping_by_namespace_nested | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_node_grouping_by_namespace_dependencies(
self, request, pipeline_name, expected
):
"""Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name'... | Test for pipeline.grouped_nodes_by_namespace which returns a dictionary with the following structure:
{
'node_name/namespace_name' : {
'name': 'node_name/namespace_name',
'type': 'namespace' or 'node',
... | test_node_grouping_by_namespace_dependencies | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_bad_combine_node(self):
"""Node cannot be combined to pipeline."""
fred = node(identity, "input", "output")
test_pipeline = pipeline([fred])
with pytest.raises(TypeError):
test_pipeline + fred | Node cannot be combined to pipeline. | test_bad_combine_node | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_bad_combine_int(self):
"""int cannot be combined to pipeline, tests __radd__"""
fred = node(identity, "input", "output")
test_pipeline = pipeline([fred])
with pytest.raises(TypeError):
_ = 1 + test_pipeline | int cannot be combined to pipeline, tests __radd__ | test_bad_combine_int | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_duplicate_node_confirms(self):
"""Test that non-unique dataset confirms break pipeline concatenation"""
pipeline1 = pipeline([node(identity, "input1", "output1", confirms="other")])
pipeline2 = pipeline(
[node(identity, "input2", "output2", confirms=["other", "output2"])]
... | Test that non-unique dataset confirms break pipeline concatenation | test_duplicate_node_confirms | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_remove(self):
"""Create a pipeline of 3 nodes and remove one of them"""
pipeline1 = pipeline(
[
node(biconcat, ["input", "input1"], "output1", name="a"),
node(biconcat, ["input", "input2"], "output2", name="b"),
node(biconcat, ["input"... | Create a pipeline of 3 nodes and remove one of them | test_remove | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_remove_with_partial_intersection(self):
"""Create a pipeline of 3 nodes and remove one of them using a pipeline
that contains a partial match.
"""
pipeline1 = pipeline(
[
node(biconcat, ["input", "input1"], "output1", name="a"),
node(b... | Create a pipeline of 3 nodes and remove one of them using a pipeline
that contains a partial match.
| test_remove_with_partial_intersection | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_remove_from_empty_pipeline(self):
"""Remove node from an empty pipeline"""
pipeline1 = pipeline([node(biconcat, ["input", "input1"], "output1", name="a")])
pipeline2 = pipeline([])
new_pipeline = pipeline2 - pipeline1
assert new_pipeline.inputs() == pipeline2.inputs()
... | Remove node from an empty pipeline | test_remove_from_empty_pipeline | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_node_unique_confirms(self):
"""Test that unique dataset confirms don't break pipeline concatenation"""
pipeline1 = pipeline([node(identity, "input1", "output1", confirms="output1")])
pipeline2 = pipeline([node(identity, "input2", "output2", confirms="other")])
pipeline3 = pipeli... | Test that unique dataset confirms don't break pipeline concatenation | test_node_unique_confirms | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_tags(self, tags, expected_nodes, nodes_with_tags):
"""Test that the 'only_nodes_with_tags' method correctly filters nodes based on provided tags."""
# Create a pipeline from nodes with tags.
test_pipeline = pipeline(nodes_with_tags)
# Filter the pipeline based o... | Test that the 'only_nodes_with_tags' method correctly filters nodes based on provided tags. | test_only_nodes_with_tags | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_from_nodes(self, complex_pipeline):
"""Test if the new pipeline includes nodes required by 'node2' and 'node3'."""
new_pipeline = complex_pipeline.from_nodes("node3", "node2")
nodes = {node.name for node in new_pipeline.nodes}
assert len(new_pipeline.nodes) == 3
assert ... | Test if the new pipeline includes nodes required by 'node2' and 'node3'. | test_from_nodes | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_from_nodes_unknown_raises_value_error(self, complex_pipeline):
"""Test that passing an unknown node to from_nodes results in a ValueError."""
pattern = r"Pipeline does not contain nodes named \['missing_node'\]"
with pytest.raises(ValueError, match=pattern):
complex_pipeline... | Test that passing an unknown node to from_nodes results in a ValueError. | test_from_nodes_unknown_raises_value_error | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_to_nodes(self, complex_pipeline):
"""Test if the new pipeline includes nodes that require 'node4' and 'node6'."""
new_pipeline = complex_pipeline.to_nodes("node4", "node6")
nodes = {node.name for node in new_pipeline.nodes}
assert len(new_pipeline.nodes) == 5
assert nod... | Test if the new pipeline includes nodes that require 'node4' and 'node6'. | test_to_nodes | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_to_nodes_unknown_raises_value_error(self, complex_pipeline):
"""Test that passing an unknown node to to_nodes results in a ValueError."""
pattern = r"Pipeline does not contain nodes named \['missing_node'\]"
with pytest.raises(ValueError, match=pattern):
complex_pipeline.to_... | Test that passing an unknown node to to_nodes results in a ValueError. | test_to_nodes_unknown_raises_value_error | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_unknown(self, pipeline_list_with_lists, target_node_names):
"""
Test the only_nodes fails for nodes which are not present in the pipeline.
"""
pattern = r"Pipeline does not contain nodes"
full = pipeline(pipeline_list_with_lists["nodes"])
with pytest... |
Test the only_nodes fails for nodes which are not present in the pipeline.
| test_only_nodes_unknown | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_namespacing(
self, pipeline_with_namespaces, non_namespaced_node_name
):
"""
Tests that error message will supply correct namespaces.
Example of expected error:
Pipeline does not contain nodes named ['node1']. Did you mean: ['katie.node1']?
""... |
Tests that error message will supply correct namespaces.
Example of expected error:
Pipeline does not contain nodes named ['node1']. Did you mean: ['katie.node1']?
| test_only_nodes_with_namespacing | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_namespacing_multiple_args(
self, pipeline_with_namespaces, non_namespaced_node_names
):
"""
Ensures error message includes suggestions for all provided arguments.
Expected error message example:
"Pipeline does not contain nodes named ['node1', 'node2'... |
Ensures error message includes suggestions for all provided arguments.
Expected error message example:
"Pipeline does not contain nodes named ['node1', 'node2']. Did you mean: ['katie.node1', 'lisa.node2']?"
| test_only_nodes_with_namespacing_multiple_args | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_namespacing_and_invalid_args(
self, pipeline_with_namespaces, non_namespaced_node_names
):
"""
Verifies that namespace suggestions are provided in the error message for both correct and incorrect arguments.
The regex pattern isn't specific to node names due t... |
Verifies that namespace suggestions are provided in the error message for both correct and incorrect arguments.
The regex pattern isn't specific to node names due to unordered arguments.
Expected error message example:
"Pipeline does not contain nodes named ['node1', 'invalid_node']. Di... | test_only_nodes_with_namespacing_and_invalid_args | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_from_inputs_unknown_raises_value_error(self, complex_pipeline):
"""Test for ValueError if W and Z do not exist as inputs."""
with pytest.raises(ValueError, match=r"\['W', 'Z'\]"):
complex_pipeline.from_inputs("Z", "W", "E", "C") | Test for ValueError if W and Z do not exist as inputs. | test_from_inputs_unknown_raises_value_error | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_to_outputs(self, complex_pipeline):
"""New pipeline contain all nodes to produce F and H outputs."""
new_pipeline = complex_pipeline.to_outputs("F", "H")
assert len(new_pipeline.nodes) == 4
assert {node.name for node in new_pipeline.nodes} == {
"node4",
... | New pipeline contain all nodes to produce F and H outputs. | test_to_outputs | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_to_outputs_unknown_raises_value_error(self, complex_pipeline):
""" "Test for ValueError if W and Z do not exist as outputs."""
with pytest.raises(ValueError, match=r"\['W', 'Z'\]"):
complex_pipeline.to_outputs("Z", "W", "E", "C") | "Test for ValueError if W and Z do not exist as outputs. | test_to_outputs_unknown_raises_value_error | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_namespace(
self, target_namespace, expected_namespaces, pipeline_with_namespaces
):
"""Test that only nodes with the matching namespace are returned from the pipeline."""
resulting_pipeline = pipeline_with_namespaces.only_nodes_with_namespace(
target_name... | Test that only nodes with the matching namespace are returned from the pipeline. | test_only_nodes_with_namespace | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_unknown_namespace_raises_value_error(self, namespace):
"""
Test that the `only_nodes_with_namespace` method raises a ValueError with the expected error message
when a non-existent namespace is provided.
"""
test_pipeline = pipeline([node(identity, "A", "B... |
Test that the `only_nodes_with_namespace` method raises a ValueError with the expected error message
when a non-existent namespace is provided.
| test_only_nodes_with_unknown_namespace_raises_value_error | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_inputs(self, complex_pipeline):
"""Test that only_nodes_with_inputs filters nodes requiring 'H' input."""
# Filter the complex pipeline to retain nodes that require 'H' as an input.
filtered_pipeline = complex_pipeline.only_nodes_with_inputs("H")
# Get the name... | Test that only_nodes_with_inputs filters nodes requiring 'H' input. | test_only_nodes_with_inputs | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_inputs_unknown(self, complex_pipeline):
"""The complex pipeline does not contain nodes W and Z so the only_nodes_with_inputs should raise an error."""
with pytest.raises(ValueError, match="['W', 'Z']"):
complex_pipeline.only_nodes_with_inputs("Z", "W", "E", "C") | The complex pipeline does not contain nodes W and Z so the only_nodes_with_inputs should raise an error. | test_only_nodes_with_inputs_unknown | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def test_only_nodes_with_outputs_on_specific_node_output(self, complex_pipeline):
"""In the complex pipeline, the node with outputs F and H was tagged node4"""
new_pipeline = complex_pipeline.only_nodes_with_outputs("F", "H")
nodes = {node.name for node in new_pipeline.nodes}
assert len... | In the complex pipeline, the node with outputs F and H was tagged node4 | test_only_nodes_with_outputs_on_specific_node_output | python | kedro-org/kedro | tests/pipeline/test_pipeline.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline.py | Apache-2.0 |
def _make_catalog(
existent=None, non_existent=None, no_exists_method=None, feed_dict=None
):
"""Creates a catalog of existent and non-existent Datasets."""
existent = [] if existent is None else existent
non_existent = [] if non_existent is None else non_existent
no_exists_method = [] if no_exists_... | Creates a catalog of existent and non-existent Datasets. | _make_catalog | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
def _from_missing(pipeline, catalog, hook_manager):
"""Create a new pipeline based on missing outputs."""
name = "kedro.runner.runner.AbstractRunner.run"
with mock.patch(name) as run:
SequentialRunner().run_only_missing(pipeline, catalog, hook_manager)
_, args, _ = run.mock_calls[0]
new_... | Create a new pipeline based on missing outputs. | _from_missing | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
def test_missing_and_no_exists(self, branched_pipeline, caplog, hook_manager):
"""If F doesn't have exists(), F is treated as missing."""
catalog = _make_catalog(
existent=["A", "B", "C", "D", "E"], no_exists_method=["F"]
)
new_pipeline = _from_missing(branched_pipeline, cata... | If F doesn't have exists(), F is treated as missing. | test_missing_and_no_exists | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
def test_propagate_up(self, branched_pipeline, hook_manager):
"""If a node needs to be rerun and requires unregistered (node-to-node)
inputs, all necessary upstream nodes should be added.
"""
catalog = _make_catalog(existent=["A"], non_existent=["E"])
new_pipeline = _from_missing... | If a node needs to be rerun and requires unregistered (node-to-node)
inputs, all necessary upstream nodes should be added.
| test_propagate_up | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
def test_propagate_down_then_up(self, branched_pipeline, hook_manager):
"""Unregistered (node-to-node) inputs for downstream nodes
should be included, too.
"""
catalog = _make_catalog(existent=["A", "D", "E"], non_existent=["C"])
new_pipeline = _from_missing(branched_pipeline, ca... | Unregistered (node-to-node) inputs for downstream nodes
should be included, too.
| test_propagate_down_then_up | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
def test_ignore_unneccessary_unreg(self, branched_pipeline, hook_manager):
"""Unregistered (node-to-node) data sources should not trigger
reruns, unless necessary to recreate registered data sources.
"""
catalog = _make_catalog(existent=["A", "E", "F"])
new_pipeline = _from_missi... | Unregistered (node-to-node) data sources should not trigger
reruns, unless necessary to recreate registered data sources.
| test_ignore_unneccessary_unreg | python | kedro-org/kedro | tests/pipeline/test_pipeline_from_missing.py | https://github.com/kedro-org/kedro/blob/master/tests/pipeline/test_pipeline_from_missing.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.