Skip to content

Commit

Permalink
Fix PartitionedDataset tests (#2727)
Browse files Browse the repository at this point in the history
Signed-off-by: Nok Chan <nok.lam.chan@quantumblack.com>
  • Loading branch information
noklam authored Jun 26, 2023
1 parent fd8162d commit 2ec03ad
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/io/test_partitioned_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def test_dataset_creds(self, pds_config, expected_ds_creds, global_creds):
assert pds._credentials == global_creds


BUCKET_NAME = "s3_fake_bucket_name"
BUCKET_NAME = "fake_bucket_name"
S3_DATASET_DEFINITION = [
"pandas.CSVDataSet",
"kedro.extras.datasets.pandas.CSVDataSet",
Expand Down Expand Up @@ -471,6 +471,19 @@ def test_load_s3a(self, mocked_csvs_in_s3, partitioned_data_pandas, mocker):
]
mocked_ds.assert_has_calls(expected, any_order=True)

@pytest.mark.parametrize(
"partition_path", ["s3_bucket/dummy.csv", "fake_bucket/dummy.csv"]
)
def test_join_protocol_with_bucket_name_startswith_protocol(
self, mocked_csvs_in_s3, partition_path
):
"""Make sure protocol is joined correctly for the edge case when
bucket name starts with the protocol name, i.e. `s3://s3_bucket/dummy_.txt`
"""

pds = PartitionedDataset(mocked_csvs_in_s3, "pandas.CSVDataSet")
assert pds._join_protocol(partition_path) == f"s3://{partition_path}"

@pytest.mark.parametrize("dataset", S3_DATASET_DEFINITION)
def test_save(self, dataset, mocked_csvs_in_s3):
pds = PartitionedDataset(mocked_csvs_in_s3, dataset)
Expand Down

0 comments on commit 2ec03ad

Please sign in to comment.