tests: add CSV format test for v.db.select#7032
Conversation
wenzeslaus
left a comment
There was a problem hiding this comment.
Since the code is touching format == CSV code, it would be good to test that beyond the one test which is there which is looking at the values but in a way abstracts the format itself. Add a test which is in the same style as testComma, but with format="csv". Attach screenshots which show the test actually runs and also that it fails if you intentionally introduce error into the code.
Similarly, extent test is missing as far as I can tell. We can't merge these without a clear proof these are actually running.
|
Hi @wenzeslaus, thanks for the detailed feedback. CSV format path: added testFormatCsv() in vector/v.db.select/testsuite/test_v_db_select.py, written in the same style as testComma, but using format="csv". This verifies the CSV-specific behavior (text fields quoted), so the format == CSV branch is now directly exercised. Extent path: added testJSONExtent() covering -r with format=json, asserting that the output contains an extent object with numeric n/s/w/e keys. To provide clear proof that these tests are actually running and meaningful, I’ve attached three screenshots:
Let me know if you’d like an additional extent test for another output format as well.
|
|
Hi @Abhi-d-gr8, this is a good PR, but in the end I decided to go with #7076. I was thinking we could still merge the CSV test though, if you update your PR to contain just that. |
866fb4b to
791708a
Compare
|
Hi @petrasovaa !, |
petrasovaa
left a comment
There was a problem hiding this comment.
Sorry for the delay, I think this is good to go.



Added test for the format=csv code path in v.db.select. The existing testComma test covers separator=comma which doesn't quote text fields, but format=csv follows RFC 4180 and wraps text fields in double quotes (e.g. "Zwe" instead of Zwe). This test makes sure that behavior is covered.