Skip to content

Test: Add unit tests for human-readable date/time formatters - #4388

Open
prabhleen2317 wants to merge 2 commits into
apache:mainfrom
prabhleen2317:test-datetime-human-formatters
Open

prabhleen2317 wants to merge 2 commits into
apache:mainfrom
prabhleen2317:test-datetime-human-formatters

Conversation

@prabhleen2317

Copy link
Copy Markdown
Contributor

Summary

  • Add unit tests for the previously untested to_human_* date/time
    formatters in pyiceberg/utils/datetime.py
    (to_human_year/month/day/hour/time/timestamp/timestamptz)
  • Also cover micros_to_days and days_to_date
  • Pure input→output functions; tests use explicit expected values

Closes #4387

Test plan

  • make test PYTEST_ARGS="-k datetime" — all pass
  • make lint — clean (ruff, format, mypy, codespell)

Cover the previously untested to_human_* formatters in
pyiceberg/utils/datetime.py, plus micros_to_days and days_to_date.
Comment thread tests/utils/test_datetime.py Resolved
Comment thread tests/utils/test_datetime.py Resolved
Cover the Julian/Gregorian boundary (proleptic Gregorian, per spec) in
days_to_date, and negative pre-1970 inputs in the human-readable
timestamp formatters, per review feedback.
@prabhleen2317

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @ebyhr! Addressed both in 4047bb6:

  • Added the 1582 Julian/Gregorian boundary cases (1582-10-04/05/15) in test_days_to_date, with a comment noting the proleptic Gregorian behavior per the Iceberg spec.
  • Added pre-epoch (-1, …) cases in both test_to_human_timestamp and test_to_human_timestamptz.

@prabhleen2317

Copy link
Copy Markdown
Contributor Author

Hello @ebyhr , @Fokko and @rambleraptor could you please have a look towards the changes made !

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing unit tests for human-readable date/time formatters in utils/datetime.py

2 participants