aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorBonfaceKilz2022-04-05 15:02:13 +0300
committerBonfaceKilz2022-04-07 11:54:28 +0300
commitac8299161bb1a4611d6e4a33b9dd9ace635d85e9 (patch)
treee40c5d07ac5c5fcd63fe385e6f6b20bca51efc3b /tests/unit
parent7d898c70c94d78a7dc81acf43ccfe2cdd7c5172c (diff)
downloadgenenetwork3-ac8299161bb1a4611d6e4a33b9dd9ace635d85e9.tar.gz
Add method for parsing a csv header from uploaded sample-data file
* gn3/csvcmp.py (parse_csv_column): New function. * tests/unit/test_csvcmp.py: Test case for the above.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_csvcmp.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/test_csvcmp.py b/tests/unit/test_csvcmp.py
index 0843bef..c8b69c7 100644
--- a/tests/unit/test_csvcmp.py
+++ b/tests/unit/test_csvcmp.py
@@ -7,6 +7,7 @@ from gn3.csvcmp import extract_invalid_csv_headers
from gn3.csvcmp import extract_strain_name
from gn3.csvcmp import fill_csv
from gn3.csvcmp import get_allowable_sampledata_headers
+from gn3.csvcmp import parse_csv_column
from gn3.csvcmp import remove_insignificant_edits
@@ -198,3 +199,14 @@ BXD15,14,x,"""
assert clean_csv_text(csv_text) == expected_csv
assert clean_csv_text("a,b \n1,2\n") == "a,b\n1,2"
+
+
+@pytest.mark.unit_test
+def test_parse_column_string():
+ """Test that a column is parsed correctly"""
+ assert parse_csv_column("Header") == (None, "Header")
+ assert parse_csv_column("Header (1)") == ("1", "Header")
+ assert parse_csv_column("Some Other Header (1)") == (
+ "1",
+ "Some Other Header",
+ )