aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorAlexander2022-05-28 20:15:39 +0300
committerBonfaceKilz2022-06-29 17:41:16 +0300
commit5d78eddfe974958bb90b3cc84bf8f8a78b568b01 (patch)
treef03d31d356ed59ff73fc2f72e9521ac9f06f1a22 /tests/unit
parent01f1af8f0c7149d8454b68d3cca25b9af50011da (diff)
downloadgenenetwork3-5d78eddfe974958bb90b3cc84bf8f8a78b568b01.tar.gz
parse output data
Diffstat (limited to 'tests/unit')
-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