-
Notifications
You must be signed in to change notification settings - Fork 948
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
Added a range option to Worksheet.get_notes
[Issue #1482]
#1487
Conversation
hi! thanks for the change! your code was all good, but the test cassette was breaking things. This is common, and what I usually do is completely delete the JSON test cassette and re-create it, effectively running: rm tests\cassettes\WorksheetTest.test_get_notes.json
GS_CREDS_FILENAME="tests/creds.json"
GS_RECORD_MODE="all"
pytest -k "test_get_notes" -v -s tests/
# check it worked
GS_RECORD_MODE="none"
pytest -k "test_get_notes" -v -s tests/ I have reformatted the test a little so it is easier to read for me, and changed Also, in testing, I noticed that again thanks for the change! I will let @lavigne958 read this and merge when happy with it :) |
Wait is that wrong? For example, there are three worksheets (Sheet1, Sheet2, Sheet3).
If you change |
As it turns out... yes and no! ;] When you provide a range, i.e., here Then the returned results has only one sheet. Printing > get_notes()
# res =
{'sheets':
[
{'data': [{}]},
{'data': [{'rowData': [{'values': [{'note': 'the first time'}]}, {}, {'values': [{}, {'note': 'two sheets'}]}]}]}
]
}
> get_notes("A2:C3")
# res =
{'sheets':
[
{'data': [{'rowData': [{}, {'values': [{}, {'note': 'two sheets'}]}]}]}
]
} So in the initial case, we do need to index it with In the second case, we need to use I have made the test clearer (split it out) and 'fixed' it by always providing Thanks for spotting @nbwzx ! :) |
Worksheet.get_range
[Issue #1482]Worksheet.get_notes
[Issue #1482]
sorry for jumping on your PR @muddi900. wouldn't have happened without you ;] so thanks for proposing the change! will let @lavigne958 review and with an approval I will merge, and this can be included in 6.2.0 :) |
No need to apologize. Thank you for the help. |
@alifeee |
Do you have a public big sheet I can test this on? |
The one I mentioned is https://docs.google.com/spreadsheets/d/158F-jyu8ld8kbdD4I_Lqy4fsX5vvp_MQOq7Ofg8NdSI/ on Sheet name |
I am getting a different error when using the latest error.
Since the method was on the Worksheet instance, there was no way to get the wrong index on right now, the request params passthrough |
Thank you everyone for the hard work and the all the edge case testing ! we managed to catch a very particular use case that we would not see otherwise 💪 I tried it and it works fine, it is well explained that the resulting matrix is not square. something like:
that requires us to do some computation based on the resulting matrix, meaning on a big big sheet we need to iterate over all rows to find the longest row before iterating again on all rows to expand them. I'm fine with it, what do you guys think about it ? |
I agree. I think it is not convenient for users to copy the relevant code from the documentation. |
@alifeee Sorry for the I have incorporated the changes suggested in the comment. |
no worries :) I have refreshed the test cassette (by deleting Also, the muddi900/gspread@add/notes-range...burnash:gspread:add/notes-range-tests |
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 changes are good.
The CI is failing due to outdated/missing cassette.
Please remove the recorded cassette: tests/cassettes/WorksheetTest.test_get_notes.json
and record the cassettes again.
You can use the value new_episodes
to only record the missing cassette.
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.
your tests are still failing, please remove the file tests/cassettes/WorksheetTest.test_get_notes.json
and run the test with the following command: GS_RECORD_MODE='new_episodes' CREDS_FILENAME=<path to credentials> tox -e py
the test |
So should autofill be a different issue. Because that would be a rewrite of the method. |
I am sorry I don't understand your comment, could you please elaborate ? |
I was referring to this |
I see, thank you. |
I come back to the point about If you don't have time or struggle with the cassettes @muddi900, just let me know and I'll cherry-pick you commits, you'll be mentioned as contributor still and we'll merge these changes soon. |
Signed-off-by: Alexandre Lavigne <lavigne958@gmail.com>
Thanks @muddi900 for this contribution ! I fixed the missing cassettes and the small conflict with master branch, this is a go for mege. |
Fixes #1482