Skip to content

Commit 2463de2

Browse files
committed
test: allow for another output in test_flowchart
1 parent 4974fef commit 2463de2

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

eds_scikit/biology/utils/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import glob
2+
import os
23
from pathlib import Path
34
from typing import List
45

56
import pandas as pd
6-
from importlib_metadata import os
77
from loguru import logger
88

99
from eds_scikit.biology.utils.process_concepts import ConceptsSet

eds_scikit/utils/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def assert_equal(
9696
return output
9797

9898

99-
def assert_images_equal(image_1: str, image_2: str):
99+
def images_are_equal(image_1: str, image_2: str):
100100
img1 = Image.open(image_1)
101101
img2 = Image.open(image_2)
102102

@@ -110,7 +110,7 @@ def assert_images_equal(image_1: str, image_2: str):
110110

111111
if sum_sq_diff == 0:
112112
# Images are exactly the same
113-
pass
113+
return True
114114
else:
115115
normalized_sum_sq_diff = sum_sq_diff / np.sqrt(sum_sq_diff)
116-
assert normalized_sum_sq_diff < 0.001
116+
return normalized_sum_sq_diff < 0.001
20.3 KB
Loading

tests/flowchart/test_flowchart.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
from eds_scikit.utils.flowchart import Flowchart
8-
from eds_scikit.utils.test_utils import assert_images_equal
8+
from eds_scikit.utils.test_utils import images_are_equal
99

1010
data_as_df = pd.DataFrame(
1111
dict(
@@ -63,12 +63,13 @@ def test_flowchart(data, tmpdir_factory):
6363

6464
_ = F.generate_flowchart(alternate=True, fontsize=10)
6565

66-
result_path = tmp_dir / "flowchart.png"
67-
F.save(result_path, dpi=72)
66+
out_path = tmp_dir / "flowchart.png"
67+
F.save(out_path, dpi=72)
6868

69-
expected = Path(__file__).parent / "expected_flowchart.png"
69+
target_1 = Path(__file__).parent / "expected_flowchart.png"
70+
target_2 = Path(__file__).parent / "expected_flowchart_bis.png"
7071

71-
assert_images_equal(result_path, expected)
72+
assert images_are_equal(out_path, target_1) or images_are_equal(out_path, target_2)
7273

7374

7475
def test_incorrect_data():

0 commit comments

Comments
 (0)