Skip to content

Recognize dates inside reversed intervals - #1022

Open
charan-rathore wants to merge 1 commit into
python-pendulum:masterfrom
charan-rathore:fix-reversed-interval-membership
Open

charan-rathore wants to merge 1 commit into
python-pendulum:masterfrom
charan-rathore:fix-reversed-interval-membership

Conversation

@charan-rathore

Copy link
Copy Markdown

A reversed interval can be iterated from its start to its end, but its membership check always returns False. For example, January 3 is yielded by an interval from January 4 to January 2 but is reported absent by the same interval.

Compare against the reversed bounds when start exceeds end. Preserve inclusive endpoints and forward interval behavior. Add twenty regression cases covering Date and DateTime values, both directions, endpoints, and values outside the bounds.

This is a self-discovered bug. No issue or prior maintainer discussion is claimed.

Validation on Python 3.12.12:

  • Exact unpatched master: six regression failures, fourteen passes; public API reproduction fails.
  • Patched full pure-Python suite: 1,869 passed, three skipped.
  • Repository Ruff lint using its configured 0.14.11 version passes. Changed-file formatting passes.
  • Locked mypy 1.13.0 passes over 229 source files.

The Rust extension variant, Rust lint, documentation build, other Python versions and operating systems were not tested. This changes Python interval membership only.

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code. No documentation change is needed for this correction to existing interval membership.

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.

1 participant