aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorBonfaceKilz2022-02-24 17:13:17 +0300
committerBonfaceKilz2022-03-12 15:33:09 +0300
commite225054a167086b97923a8449fd0af013ce26933 (patch)
tree7e72266aa739c2de8b55b70ef9c286522f342276 /tests/unit
parent613987ef99009574bfd403973210de4d90da7c73 (diff)
downloadgenenetwork3-e225054a167086b97923a8449fd0af013ce26933.tar.gz
Create new method for filling csv with a default value
* gn3/csvcmp.py (fill_csv): Given a csv text with uneven or incomplete fields whole length are less than width, fill them with a value which defaults to "x". * tests/unit/test_csvcmp.py (test_fill_csv): Test cases for the above.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_csvcmp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/test_csvcmp.py b/tests/unit/test_csvcmp.py
index f73865d..716adb5 100644
--- a/tests/unit/test_csvcmp.py
+++ b/tests/unit/test_csvcmp.py
@@ -1,10 +1,27 @@
from gn3.csvcmp import csv_diff
+from gn3.csvcmp import fill_csv
from gn3.csvcmp import remove_insignificant_edits
import pytest
@pytest.mark.unit_test
+def test_fill_csv():
+ test_input = """
+Strain Name,Value,SE,Count
+BXD1,18,x,0
+BXD12,16,x,x
+BXD14,15,x,x
+BXD15,14,x,x
+"""
+ expected_output = """Strain Name,Value,SE,Count,Sex
+BXD1,18,x,0,x
+BXD12,16,x,x,x
+BXD14,15,x,x,x
+BXD15,14,x,x,x"""
+ assert(fill_csv(test_input, width=5, value="x"))
+
+@pytest.mark.unit_test
def test_remove_insignificant_data():
diff_data = {
'Additions': [],