-
Notifications
You must be signed in to change notification settings - Fork 703
feat(bindings/python): Enhance Reader and Writer #6086
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
Hi, I think the additional options for |
85446eb to
e532bbf
Compare
erickguan
left a comment
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.
Great feature and nice chore work!
I added a few suggestions.
|
added a temp fix for the breaking tests. |
erickguan
left a comment
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.
Minor comments on test exceptions.
LGTM
bindings/python/tests/test_write.py
Outdated
| with pytest.raises(Exception)as excinfo: | ||
| async with await async_operator.open(filename, "wb", if_not_exists=True) as w: | ||
| w.write(content) | ||
| assert "ConditionNotMatch" in str(excinfo.value) |
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.
minor: blank around the keyword as.
Perhaps you can import ConditionNotMatch which aligns with other code. Then:
| with pytest.raises(Exception)as excinfo: | |
| async with await async_operator.open(filename, "wb", if_not_exists=True) as w: | |
| w.write(content) | |
| assert "ConditionNotMatch" in str(excinfo.value) | |
| with pytest.raises(ConditionNotMatch): | |
| async with await async_operator.open(filename, "wb", if_not_exists=True) as w: | |
| w.write(content) |
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.
related discussion: #6235
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.
@erickguan this is what i did before, but there was a different issue.
I'll address that in a separate PR.
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.
@chitralverma Thank you so much for bringing up the issue, investigation, and fix! You can add a TODO or a link to the GitHub issue. I will not make this comment in that case :)
bindings/python/tests/test_write.py
Outdated
| with pytest.raises(Exception)as excinfo: | ||
| with operator.open(filename, "wb", if_not_exists=True) as w: | ||
| w.write(content) | ||
| assert "ConditionNotMatch" in str(excinfo.value) |
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.
| with pytest.raises(Exception)as excinfo: | |
| with operator.open(filename, "wb", if_not_exists=True) as w: | |
| w.write(content) | |
| assert "ConditionNotMatch" in str(excinfo.value) | |
| with pytest.raises(ConditionNotMatch): | |
| with operator.open(filename, "wb", if_not_exists=True) as w: | |
| w.write(content) |
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.
@erickguan this is what i did before, but there was a different issue.
I'll address that in a separate PR.
related discussion: #6235
|
@Xuanwo @erickguan all your suggestions have been included now, and I've updated the description for this PR. |
|
Thank you @chitralverma for working on this. Although we haven't addressed #6235 yet, I think it's fine to use a workaround in the tests for now. Will merge after CI passed. |
Which issue does this PR close?
Closes #5943
What changes are included in this PR?
open(...)read(...)write(...)Are there any user-facing changes?
No breaking changes, but users can use the new features.