Skip to content

Commit 14d27e7

Browse files
committed
Avoid running tests twice if they error out
1 parent f22e61d commit 14d27e7

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/flowmapper/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33
from enum import Enum
44
from pathlib import Path
5-
from typing import Optional
65

76
from flowmapper.flow import Flow
87
from flowmapper.flowmap import Flowmap
@@ -38,14 +37,14 @@ def flowmapper(
3837
format: OutputFormat,
3938
version: str = "1.0.0",
4039
default_transformations: bool = True,
41-
transformations: Optional[list[Path | str]] = None,
40+
transformations: list[Path | str] | None = None,
4241
unmatched_source: bool = True,
4342
unmatched_target: bool = True,
4443
matched_source: bool = False,
4544
matched_target: bool = False,
46-
licenses: Optional[list] = None,
47-
homepage: Optional[str] = None,
48-
name: Optional[str] = None,
45+
licenses: list | None = None,
46+
homepage: str | None = None,
47+
name: str | None = None,
4948
) -> Flowmap:
5049
"""
5150
Generate mappings between elementary flows lists

tests/test_id_generation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ def test_generate_flow_id():
88
"unit": "kg",
99
"CAS number": "000110-63-4",
1010
}
11-
assert generate_flow_id(flow1) == "77bb0c932afd7d7eb7ada382c8828b9f", f"Expected generate_flow_id(flow1) to equal '77bb0c932afd7d7eb7ada382c8828b9f', but got {generate_flow_id(flow1)!r}"
11+
actual = generate_flow_id(flow1)
12+
expected = "77bb0c932afd7d7eb7ada382c8828b9f"
13+
assert actual == expected, f"Expected generate_flow_id(flow1) to equal '{expected}', but got {actual!r}"

tests/test_match_custom_names_with_location_codes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def test_match_custom_names_with_location_codes_no_match():
5858
t = Flow(
5959
{"name": "water, unspecified natural origin", "context": "air", "unit": "kg"}
6060
)
61-
assert match_custom_names_with_location_codes(s, t, [], []) is None, f"Expected match_custom_names_with_location_codes to return None, but got {match_custom_names_with_location_codes(s, t, [], [])}"
61+
result = match_custom_names_with_location_codes(s, t, [], [])
62+
assert result is None, f"Expected match_custom_names_with_location_codes to return None, but got {result}"
6263

6364

6465
def test_match_custom_names_with_location_codes_conversion():

tests/test_match_names_with_country_codes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def test_match_names_with_country_codes_extra_whitespace():
2323
def test_match_names_with_country_codes_no_match():
2424
s = Flow({"name": "Ammonia-NL", "context": "air", "unit": "kg"})
2525
t = Flow({"name": "Ammonia", "context": "air", "unit": "kg"})
26-
assert match_names_with_location_codes(s, t, [], []) is None, f"Expected match_names_with_location_codes to return None, but got {match_names_with_location_codes(s, t, [], [])}"
26+
result = match_names_with_location_codes(s, t, [], [])
27+
assert result is None, f"Expected match_names_with_location_codes to return None, but got {result}"
2728

2829

2930
def test_match_names_with_country_codes_complicated_location():

0 commit comments

Comments
 (0)