Skip to content

Commit f9593e6

Browse files
committed
fix: correct rwr/strwr output
1 parent 395d6bb commit f9593e6

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
B|D
2-
C|E
3-
A|C
4-
C|B
5-
A|B
1+
Node Score
2+
C 0.45223350636731136
3+
E 0.1921988728212533
4+
B 0.1921988728212533
5+
D 0.16336874799018208
6+
A 0.0

test/RWR/test_RWR.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
import shutil
2-
import sys
32
from filecmp import cmp
43
from pathlib import Path
54

65
import pytest
76

87
import spras.config as config
8+
from spras.rwr import RWR
99

1010
config.init_from_file("config/config.yaml")
1111

12-
# TODO consider refactoring to simplify the import
13-
# Modify the path because of the - in the directory
14-
SPRAS_ROOT = Path(__file__).parent.parent.parent.absolute()
15-
sys.path.append(str(Path(SPRAS_ROOT, 'docker-wrappers', 'RWR')))
16-
from spras.rwr import RWR
17-
1812
TEST_DIR = Path('test', 'RWR/')
1913
OUT_FILE = Path(TEST_DIR, 'output', 'rwr-output.txt')
2014

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
B|D
2-
C|E
3-
A|C
4-
C|B
5-
A|B
1+
Node Score
2+
A 0.32384402678489604
3+
C 0.24316175317121075
4+
E 0.22749257483815752
5+
B 0.11108216475037477
6+
D 0.09441948045536093

test/ST_RWR/test_STRWR.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import shutil
2+
from filecmp import cmp
23
from pathlib import Path
34

45
import pytest
@@ -25,6 +26,8 @@ def test_strwr(self):
2526
alpha=0.85,
2627
output_file=OUT_FILE)
2728
assert OUT_FILE.exists(), 'Output file was not written'
29+
expected_file = Path(TEST_DIR, 'expected_output', 'strwr-output.txt')
30+
assert cmp(OUT_FILE, expected_file, shallow=False), 'Output file does not match expected output file'
2831

2932
"""
3033
Run the ST_RWR algorithm with a missing input file
@@ -47,6 +50,7 @@ def test_format_error(self):
4750
targets=Path(TEST_DIR, 'input','strwr-targets.txt'),
4851
alpha=0.85,
4952
output_file=OUT_FILE)
53+
5054
# Only run Singularity test if the binary is available on the system
5155
# spython is only available on Unix, but do not explicitly skip non-Unix platforms
5256
@pytest.mark.skipif(not shutil.which('singularity'), reason='Singularity not found on system')

0 commit comments

Comments
 (0)