-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Use b64decode and b64encode for Base64Bytes type
#10486
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
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
3b80ba9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://617bf15e.pydantic-docs.pages.dev |
| Branch Preview URL: | https://base-64-bytes-fix.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #10486 will not alter performanceComparing Summary
|
|
One lingering concern that I have here is the failing test relating to round tripping: from pydantic import BaseModel, Base64Bytes
input_data = b'Zm9vIGJhcg==\n'
expected_value = b'foo bar'
class Model(BaseModel):
base64_value: Base64Bytes
m = Model(base64_value=input_data)
assert m.base64_value == expected_value
assert m.model_dump()['base64_value'] == input_data
# b'Zm9vIGJhcg==' != b'Zm9vIGJhcg==\n' |
b64decode and b64encode for Base64Bytes type
We've discussed - this isn't an issue, the whole point was to move to the newer function not adding a newline automatically. Validation still succeeds, so round tripping is fine. This is similar to url behavior, etc. |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
|
Thank you @sydney-runkle, this is fantastic! |
Closes #9072
Change that should be highlighted in the upcoming release notes + blog post.