aboutsummaryrefslogtreecommitdiff
path: root/gn3/csvcmp.py
diff options
context:
space:
mode:
authorBonfaceKilz2022-02-25 12:08:02 +0300
committerBonfaceKilz2022-03-12 15:33:09 +0300
commit8a7335cdb3fe9e906cefa719e336a7266a9b253b (patch)
tree6d57c6168269f67bc3f00a10a0f13d01d53dd1ad /gn3/csvcmp.py
parent0c1a6fb91b8bf9cf2b68ba54d8905e4c6acfd341 (diff)
downloadgenenetwork3-8a7335cdb3fe9e906cefa719e336a7266a9b253b.tar.gz
Don't add extra key "Column" to dict if there are no changes
gn3/csvcmp.py (csv_diff): If the diff is empty, don't add an extra key "Column" to the dictionary. tests/unit/test_csvcmp (test_csv_diff_only_column_change): Add test-case for the above.
Diffstat (limited to 'gn3/csvcmp.py')
-rw-r--r--gn3/csvcmp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py
index 453c97a..ebd323e 100644
--- a/gn3/csvcmp.py
+++ b/gn3/csvcmp.py
@@ -66,7 +66,8 @@ def csv_diff(base_csv, delta_csv, tmp_dir="/tmp"):
"--format json"))
if _r.get("code") == 0:
_r = json.loads(_r.get("output"))
- _r["Columns"] = max(base_csv_header, delta_csv_header)
+ if any(_r.values()):
+ _r["Columns"] = max(base_csv_header, delta_csv_header)
else:
_r = {}