aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/computations/test_rust_correlation.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/computations/test_rust_correlation.py')
-rw-r--r--tests/unit/computations/test_rust_correlation.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/unit/computations/test_rust_correlation.py b/tests/unit/computations/test_rust_correlation.py
index 1398645..121c330 100644
--- a/tests/unit/computations/test_rust_correlation.py
+++ b/tests/unit/computations/test_rust_correlation.py
@@ -2,23 +2,32 @@ import pytest
from gn3.computations.rust_correlation import CORRELATION_COMMAND
from gn3.computations.rust_correlation import run_correlation
+from gn3.computations.rust_correlation import parse_correlation_output
@pytest.mark.unit_test
+def test_run_correlation():
+ """test calling rusts' correlation """
-def test_equality():
- """initial test for sum """
-
- assert 4 == 4
+ results = run_correlation(
+ file_name="/home/kabui/correlation_rust/tests/data/sample_json_file.json", outputdir="/")
+ assert results == "hello"
@pytest.mark.unit_test
+def test_parse_results():
-def test_run_correlation():
- """test calling rusts' correlation """
-
+ raw_data = [
+ ["63.62", "0.97", "0.00"],
+ ["19", "-0.96", "0.22"],
+ ["77.92", "-0.94", "0.31"],
+ ["84.04", "0.94", "0.11"],
+ ["23", "-0.91", "0.11"]
+ ]
- results = run_correlation("./tests/data/sample_json_file.json")
+ expected_results = [{"trait_name": name, "corr_coeff": corr,
+ "p_val": pval} for (name, corr, pval) in raw_data]
- assert results == "hello"
+ assert parse_correlation_output(
+ "tests/unit/computations/data/correlation/sorted_results.txt") == expected_results