-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/test_passport.py::TestEnUS::testDates failure: ValueError: day is out of range for month #1870
Comments
Thanks for the report. Forced date replacement with leap years is always tricky (I remember a similar issue in another library: FactoryBoy/factory_boy#969). Would you be interested in submitting a corresponding PR to fix this? |
I suppose I could do that. Should the date move to the next day or the previous day? |
CC @llw2128 |
let's the previous day, but on the issue date. IE: let's special-case issue date of Feb 29th, and make it Feb 28th |
Fix handling the issue date of 29 Feb (of a leap year). Since the passports expire in 5 or 10 years, the expiration year will not be a leap year, and therefore the date needs to be adjusted to 28 Feb. Fixes joke2k#1870
* Refactor common code in passport_dates() in en_US Passport provider * Fix handling 29 Feb in en_US Passport provider Fix handling the issue date of 29 Feb (of a leap year). Since the passports expire in 5 or 10 years, the expiration year will not be a leap year, and therefore the date needs to be adjusted to 28 Feb. Fixes #1870
It's possible that I've been incredibly lucky:
Full traceback below.
Steps to reproduce
python -m pytest
;-)Expected behavior
Tests passing ;-).
Actual behavior
The text was updated successfully, but these errors were encountered: