Reject non-positive date_range steps#1339
Conversation
|
Does Python’s |
|
Thanks for checking. Python's My thinking here was that That said, if you prefer to leave this to callers or want an issue first before changing this behavior, I understand and am happy to close the PR. |
There was a problem hiding this comment.
Could you move this to the existing TestDateRangeFunction?
There was a problem hiding this comment.
Moved it into the existing TestDateRangeFunction in 4cbea3a and removed the separate test file.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1339 +/- ##
=======================================
Coverage 97.11% 97.11%
=======================================
Files 235 235
Lines 2909 2911 +2
=======================================
+ Hits 2825 2827 +2
Misses 84 84 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Please, run |
|
Ran I also ran |
Summary
Reject
date_range()steps that do not advance the generated date. Passing values such asmonths=0ordays=-1currently allows the generator to yield the start date and then continue without making forward progress, which can hang callers that consume the full iterator withlist(...).Changes
dateparser.date.date_range().Validation
python -m pytest tests/test_date_range.py -q->2 passed