-
-
Notifications
You must be signed in to change notification settings - Fork 29.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
gh-99392: Fix SQLite converter recipes #99393
gh-99392: Fix SQLite converter recipes #99393
Conversation
The converter functions are always passed a bytes object, `datetime.date.fromisoformat` and `datetime.datetime.fromisoformat` expect a `str`. In case of `convert_timestamp()` a cast to `int` is missing.
Thanks for catching that. Could you add doctests for this, so we're sure the CI catches it if we mess it up (again)? |
@erlend-aasland I've added a doctest, not sure if it is any good. Since the adapter for You feedback would be appreciated. |
Thanks! I think simple unit-tests of the actual functions should be sufficient. So something like this for each adapter/converter pair: assert adapter_fn(val) == foo
assert converter_fn(val) == bar
Yes, perhaps the docs are a little unclear about this. Those are just two examples, or variants, of |
@erlend-aasland thank you, I've simplified the doctest. As |
I'm fine with that. Thanks for adding the tests, and thanks again for the PR and the report! |
Thanks @naglis for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
(cherry picked from commit dfc1b17) Co-authored-by: naglis <827324+naglis@users.noreply.github.com>
GH-99419 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit dfc1b17) Co-authored-by: naglis <827324+naglis@users.noreply.github.com>
GH-99420 is a backport of this pull request to the 3.10 branch. |
gh-99392: The converter functions are always passed a bytes object,
datetime.date.fromisoformat
anddatetime.datetime.fromisoformat
expect astr
. In case ofconvert_timestamp()
a cast toint
is missing.