Skip to content

Commit

Permalink
Address comments from PR #31
Browse files Browse the repository at this point in the history
* Remove 'run_date_date' instantiation
* Rename 'run_date_date' to 'run_date_obj'
* Create private helper method '_parse_date_filters'
* Update Python dependencies (removes 'types-python-dateutil')
* Update 'invalid type' test
* Rework TIMDEX_DATASET_FILTER_COLUMNS global (convert to tuple, describe required order)
* Move 'row_count' to top of TIMDEXDataset class
* Make 'get_partition_prefixes' a private method
  • Loading branch information
jonavellecuerdo committed Dec 19, 2024
1 parent 215e946 commit 0cc15c3
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 122 deletions.
123 changes: 57 additions & 66 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@ def test_dataset_get_filtered_dataset_by_run_date_if_invalid_type_raise_error(
"or a datetime.date."
),
):
_ = fixed_local_dataset._get_filtered_dataset(run_date=0)
_ = fixed_local_dataset._get_filtered_dataset(run_date=999)


def test_dataset_get_partition_prefixes_with_run_date_success():
timdex_dataset = TIMDEXDataset(location="s3://bucket/path/to/dataset")

assert (
timdex_dataset.get_partition_prefixes(run_date="2024-12-01")
timdex_dataset._get_partition_prefixes(run_date="2024-12-01")
== "year=2024/month=12/day=01"
)

Expand All @@ -222,21 +222,21 @@ def test_dataset_get_partition_prefixes_without_run_date_success():
timdex_dataset = TIMDEXDataset(location="s3://bucket/path/to/dataset")

assert (
timdex_dataset.get_partition_prefixes(year="2024", month="12", day="01")
timdex_dataset._get_partition_prefixes(year="2024", month="12", day="01")
) == "year=2024/month=12/day=01"
assert (
timdex_dataset.get_partition_prefixes(year="2024", month="12")
timdex_dataset._get_partition_prefixes(year="2024", month="12")
== "year=2024/month=12"
)
assert timdex_dataset.get_partition_prefixes(year="2024") == "year=2024"
assert timdex_dataset._get_partition_prefixes(year="2024") == "year=2024"


def test_dataset_get_partition_prefixes_without_run_date_raise_error():
timdex_dataset = TIMDEXDataset(location="s3://bucket/path/to/dataset")
with pytest.raises(
ValueError, match="Insufficient arguments to construct a valid partition prefix."
):
assert timdex_dataset.get_partition_prefixes(month="12", day="01")
assert timdex_dataset._get_partition_prefixes(month="12", day="01")


def test_dataset_get_s3_filesystem_success(mocker):
Expand Down
2 changes: 1 addition & 1 deletion timdex_dataset_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from timdex_dataset_api.dataset import TIMDEXDataset
from timdex_dataset_api.record import DatasetRecord

__version__ = "0.3.0"
__version__ = "0.4.0"

__all__ = [
"DatasetRecord",
Expand Down
Loading

0 comments on commit 0cc15c3

Please sign in to comment.