Skip to content

Commit 1846820

Browse files
Merge branch 'main' into 4-build-automation
2 parents f254643 + 9fb8820 commit 1846820

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/hermes_toml/harvest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def handle_person_in_unknown_format(cls, persons):
185185
#try to parse the string
186186
try:
187187
[(name, email)] = getaddresses([person])
188-
return cls.remove_forbidden_keys({"name":name, "email":email})
188+
return_list.append(cls.remove_forbidden_keys({"name":name, "email":email}))
189189
except ValueError as exc:
190190
raise ValueError("Wrong string format for name (and email).") from exc
191191

test/hermes_toml_test/test_harvest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def toml_file(tmp_path_factory):
4949
({"project":{"authors":{"givenName":"a", "a":"b"}}}, {"author":{"givenName":"a", "@type":"Person"}}),
5050
({"project":{"authors":{"a":"b"}}}, {}),
5151
({"project":{"authors":[{"a":"a"}, {"givenName":"a"}]}}, {"author":{"givenName":"a", "@type":"Person"}}),
52-
({"project":{"authors":[{"a":"b"}]}}, {})
52+
({"project":{"authors":[{"a":"b"}]}}, {}),
53+
({"project":{"authors":["abc def<abc.def@dlr.com>"]}}, {"author":{"name":"abc def", "email": "abc.def@dlr.com", "@type": "Person"}}),
54+
({"project":{"authors":"abc def<abc.def@dlr.com>"}}, {"author":{"name":"abc def", "email": "abc.def@dlr.com", "@type": "Person"}})
5355
])
5456
def test_read_from_toml(in_data, out_data, toml_file):
5557
toml.dump(in_data, open(toml_file, "w", encoding="utf8"))
@@ -58,7 +60,9 @@ def test_read_from_toml(in_data, out_data, toml_file):
5860
@pytest.mark.parametrize("in_data", [
5961
({"project": {"authors":1}}), ({"tool": {"poetry": {"authors":1}}}),
6062
({"project": {"authors":[1]}}), ({"tool": {"poetry": {"authors":[1]}}}),
61-
({"project": {"name":"a"}, "tool": {"poetry": {"name":"a"}}})
63+
({"project": {"name":"a"}, "tool": {"poetry": {"name":"a"}}}),
64+
({"project": {"authors":["as<as>as"]}}),
65+
({"project": {"authors":"as<as>as"}})
6266
])
6367
def test_read_from_toml_with_error(in_data, toml_file):
6468
toml.dump(in_data, open(toml_file, "w", encoding="utf8"))

0 commit comments

Comments
 (0)