aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_partial_correlations.py1
-rw-r--r--tests/unit/test_csvcmp.py41
2 files changed, 32 insertions, 10 deletions
diff --git a/tests/integration/test_partial_correlations.py b/tests/integration/test_partial_correlations.py
index d249b42..4bf352a 100644
--- a/tests/integration/test_partial_correlations.py
+++ b/tests/integration/test_partial_correlations.py
@@ -212,6 +212,7 @@ def test_partial_correlation_api_with_non_existent_control_traits(client, post_d
# difficult to test for these without a temp database with the temp
# traits data set to something we are in control of
)
+
def test_part_corr_api_with_mix_of_existing_and_non_existing_control_traits(
db_conn, primary, controls, method, target):
"""
diff --git a/tests/unit/test_csvcmp.py b/tests/unit/test_csvcmp.py
index 716adb5..023415d 100644
--- a/tests/unit/test_csvcmp.py
+++ b/tests/unit/test_csvcmp.py
@@ -46,13 +46,34 @@ def test_remove_insignificant_data():
@pytest.mark.unit_test
-def test_csv_diff():
- test_results = csv_diff(base_csv="a,b\n1,2\n",
- delta_csv="a,b\n1,3")
- _json = {
- 'Additions': [],
- 'Deletions': [],
- 'Modifications': [{'Current': '1,3', 'Original': '1,2'}]
- }
- assert(test_results.get("code") == 0 and
- test_results.get("output") == _json)
+def test_csv_diff_same_columns():
+ assert(csv_diff(base_csv="a,b\n1,2\n",
+ delta_csv="a,b\n1,3") == {
+ 'Additions': [],
+ 'Deletions': [],
+ 'Columns': '',
+ 'Modifications': [{'Current': '1,3',
+ 'Original': '1,2'}]})
+
+
+@pytest.mark.unit_test
+def test_csv_diff_different_columns():
+ base_csv = """
+Strain Name,Value,SE,Count
+BXD1,18,x,0
+BXD12,16,x,x
+BXD14,15,x,x
+BXD15,14,x,x
+"""
+ delta_csv = """Strain Name,Value,SE,Count,Sex
+BXD1,18,x,0
+BXD12,16,x,x,1
+BXD14,15,x,x
+BXD15,14,x,x"""
+ assert(csv_diff(base_csv=base_csv,
+ delta_csv=delta_csv) == {
+ 'Additions': [],
+ 'Columns': 'Strain Name,Value,SE,Count,Sex',
+ 'Deletions': [],
+ 'Modifications': [{'Current': 'BXD12,16,x,x,1',
+ 'Original': 'BXD12,16,x,x,x'}]})