Skip to content

Commit 6d16860

Browse files
committed
tests: implement code suggestions by sourcery
1 parent 0f881f7 commit 6d16860

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

.coverage

0 Bytes
Binary file not shown.

tests/test_dict2xml.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,3 +597,20 @@ def test_convert_list_with_custom_ids(self):
597597
)
598598
assert 'id="root_' in result
599599
assert '>test<' in result
600+
601+
def test_convert_list_mixed_types(self):
602+
"""Test convert_list with a mix of valid and invalid types."""
603+
class CustomClass:
604+
pass
605+
606+
items = ["valid string", 100, {"a": "b"}, CustomClass()]
607+
with pytest.raises(TypeError, match="Unsupported data type:"):
608+
dicttoxml.convert_list(
609+
items=items,
610+
ids=None,
611+
parent="root",
612+
attr_type=False,
613+
item_func=lambda x: "item",
614+
cdata=False,
615+
item_wrap=False
616+
)

0 commit comments

Comments
 (0)