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
Many fixes for get_records
#1357
Conversation
unique check this way we can pad headers/values so they are the same width then, if headers has empty values, it will be found by the uniqueness check
only get [0] keys if possible
and -> keys_width
and get_all_records
To le we should return an empty list.
Make sense if the user requests a range limit then get empty values with the requested size. Otherwise juste empty list. I will take a look ASAP. By the end of the weekend it should be done. Great job and thank you for taking it si fast. |
Super :) let me know if you think we should change anything |
Looks good to me 👍 |
closes #590, #629, #1354, #1355
firstly, a test simplification
This is done for a few tests
combine
test_get_all_records_duplicate_keys
andtest_get_all_records_expected_headers
add
test_get_all_records_with_blank_final_headers
Regression test for #1354
tests
get_records
with some blank final headers, i.e.,It should throw an error, but work fine with
expected_headers
setadd
test_get_all_records_with_keys_blank
Similar to above but with the entire keys row blank
add
test_get_records_with_all_values_blank
This is the beefy one. Regression test for #590, #629, #1355
Given the sheet
What should
get_records
return?[]
?[{"a": "", "b": "", "c": ""}, {"a": "", "b": "", "c": ""}]
?This is a hard question. My answer uses the kwarg
last_index
. If this is asked for (i.e., if a user asks for "five rows"), then I believeget_records
should return a list of length asked for (i.e., length 5). If it is not asked for (i.e., if a user asks for "entire sheet"), then I believeget_records
should return an empty list (not further because we "don't know" how long a spreadsheet is). This logic is explained by:I ask for
get_records(first_index=2, last_index=4)
I want
[{...}, {...}, {...}]
I ask for
get_records()
I want
[]
I ask for
get_records(first_index=1)
I want
[]
I ask for
get_records(last_index=4)
I want
[{...}, {...}, {...}]
Thus, this is the logic I included in
test_get_records_with_all_values_blank