Skip to content

Commit 9fefc6b

Browse files
author
bosd
committed
Fix: Adjust tests to preserve . characters.
1 parent b83b78a commit 9fefc6b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

tests/test_tools.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
def test_to_xmlid() -> None:
1313
"""Test the to_xmlid function."""
14-
assert to_xmlid("A.B,C\nD|E F") == "A_B_C_D_E_F"
14+
assert to_xmlid("A.B,C\nD|E F") == "A.B_C_D_E_F"
1515
assert (
16-
to_xmlid(" leading and trailing spaces ") == "__leading_and_trailing_spaces__"
16+
to_xmlid(" leading and trailing spaces ")
17+
== "__leading_and_trailing_spaces__"
1718
)
1819
assert to_xmlid("no_special_chars") == "no_special_chars"
1920
assert to_xmlid("") == ""
@@ -23,14 +24,20 @@ def test_to_m2o() -> None:
2324
"""Test the to_m2o function."""
2425
assert to_m2o("prefix", "value") == "prefix.value"
2526
assert to_m2o("prefix.", "value") == "prefix.value"
26-
assert to_m2o("prefix", " a value with spaces ") == "prefix._a_value_with_spaces_"
27+
assert (
28+
to_m2o("prefix", " a value with spaces ")
29+
== "prefix._a_value_with_spaces_"
30+
)
2731
assert to_m2o("prefix", "") == ""
2832
assert to_m2o("prefix", "", default="default_value") == "default_value"
2933

3034

3135
def test_to_m2m() -> None:
3236
"""Test the to_m2m function."""
33-
assert to_m2m("prefix", "val1,val2,val3") == "prefix.val1,prefix.val2,prefix.val3"
37+
assert (
38+
to_m2m("prefix", "val1,val2,val3")
39+
== "prefix.val1,prefix.val2,prefix.val3"
40+
)
3441
assert to_m2m("prefix", " val1 , val2 ") == "prefix.val1,prefix.val2"
3542
assert to_m2m("prefix", "") == ""
3643
assert to_m2m("prefix", "val1") == "prefix.val1"
@@ -51,7 +58,10 @@ def test_attribute_line_dict() -> None:
5158
def id_gen_fun(template_id: str, attributes: dict[str, list[str]]) -> str:
5259
return f"id_{template_id}_{next(iter(attributes.keys()))}"
5360

54-
attribute_list_ids = [["att_id_1", "att_name_1"], ["att_id_2", "att_name_2"]]
61+
attribute_list_ids = [
62+
["att_id_1", "att_name_1"],
63+
["att_id_2", "att_name_2"],
64+
]
5565
aggregator = AttributeLineDict(attribute_list_ids, id_gen_fun)
5666
header = ["product_tmpl_id/id", "attribute_id/id", "value_ids/id"]
5767
line1 = [

0 commit comments

Comments
 (0)