Skip to content

5373 type hints lib: [datetime] #5488

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

silentw0lf
Copy link

No description provided.

@silentw0lf silentw0lf changed the title 5373 type hints datetime 5373 type hints lib: [datetime] Aug 19, 2025
@pekkaklarck
Copy link
Member

One of the DateTime library tests fails with this error message:

Expected error 'ValueError: Unsupported input 'None'.' but got 'ValueError: Invalid timestamp 'None'.'.

My expectation is that the keyword is used with Python None object and earlier the type has been validated internally and rejected as unsupported type. Now that the keyword has a type hint defined as a union with str as one of the accepted values, the given None is converted to a string and now the type isn't anymore invalid but the value itself is. I consider the new behavior fine so the fix is updating the test.

I recommend you to run at least DateTime library tests locally before committing changes.

@pekkaklarck
Copy link
Member

Notice that I reviewed this PR at silentw0lf#1. I assume the code is same there so comments apply also to this PR. The other should be closed now.

@silentw0lf
Copy link
Author

silentw0lf commented Aug 20, 2025

One of the DateTime library tests fails with this error message:

Expected error 'ValueError: Unsupported input 'None'.' but got 'ValueError: Invalid timestamp 'None'.'.

My expectation is that the keyword is used with Python None object and earlier the type has been validated internally and rejected as unsupported type. Now that the keyword has a type hint defined as a union with str as one of the accepted values, the given None is converted to a string and now the type isn't anymore invalid but the value itself is. I consider the new behavior fine so the fix is updating the test.

I recommend you to run at least DateTime library tests locally before committing changes.

I adapted the test passed locally)
Github Actions the must be triggered by a maintainer.

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.

2 participants