-
Notifications
You must be signed in to change notification settings - Fork 309
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
feat: allow cell magic body to be a $variable #1053
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@plamut Sorry, I tried. :-< |
OK, I'll edit the commit message then to silence the bot. |
cell_body = "$custom_query" | ||
|
||
with pytest.raises( | ||
NameError, match=r".*custom_query does not exist.*" |
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.
Maybe comment to indicate we're testing the first kind of error, as I got the regex string match from context of the other file.
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.
The name of the test explains which case it covers ("non-existing query variable"), do you think that's not sufficient by itself?
I always look at the name of the test first, although it might be just how my brain is wired...
Update: Added a comment next to the assignment to cell_body
to explain which use case it targets.
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.
LGTM - I really like how you added the "non-existing query variable" condition.
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.
LGTM - could do with more comments on test cases, perhaps.
cell_body = "$custom_query" | ||
|
||
with pytest.raises( | ||
TypeError, match=r".*must be a string or a bytes-like.*" |
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.
Might be good to have another comment here to match it to the other else
condition in run_query_magic
LGTM - appreciate the changes!! |
* feat: allow cell magic body to be a $variable * Fix missing indefinitive article in error msg * Adjust test assertion to error message change * Refactor logic for extracting query variable * Explicitly warn about missing query variable name * Thest the query "variable" is not identifier case
Closes #1040.
Thought - we probably want to follow up with a sample demonstrating this new use case.
Also, the length of the
_cell_magic()
function should be ignored for now, it's been waiting to be split into smaller units since forever. 🙂PR checklist: