Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions vector/v.db.select/testsuite/test_v_db_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
1290,63600420,109186.835938,1291,1290,Zwe,63600422.4739,109186.832069
"""

out_sep_csv = """1076,366545504,324050.96875,1077,1076,"Zwe",366545512.376,324050.97237
1123,1288.555298,254.393951,1124,1123,"Zwe",1288.546525,254.393964
1290,63600420,109186.835938,1291,1290,"Zwe",63600422.4739,109186.832069
"""

out_json = """\
{"info":
{"columns":[
Expand Down Expand Up @@ -271,6 +276,18 @@ def testComma(self):
sel.run()
self.assertLooksLike(reference=out_sep, actual=sel.outputs.stdout)

def testFormatCsv(self):
"""Test format=csv output matches expected CSV (same style as testComma)."""
sel = SimpleModule(
"v.db.select",
flags="c",
map=self.invect,
where="{col}='{val}'".format(col=self.col, val=self.val),
format="csv",
)
sel.run()
self.assertLooksLike(reference=out_sep_csv, actual=sel.outputs.stdout)

def testJSON(self):
"""Test that JSON can be decoded and formatted exactly as expected"""
import json
Expand Down
Loading