@@ -1084,7 +1084,7 @@ def test_attrs_comprehensive_xml_escaping(self) -> None:
10841084 'Element' : {
10851085 "@attrs" : {
10861086 "ampersand" : "Tom & Jerry" ,
1087- "less_than" : "value < 10" ,
1087+ "less_than" : "value < 10" ,
10881088 "greater_than" : "value > 5" ,
10891089 "quotes" : 'He said "Hello"' ,
10901090 "single_quotes" : "It's working" ,
@@ -1094,15 +1094,15 @@ def test_attrs_comprehensive_xml_escaping(self) -> None:
10941094 }
10951095 }
10961096 result = dicttoxml .dicttoxml (data , attr_type = False , item_wrap = False , root = False ).decode ('utf-8' )
1097-
1097+
10981098 # Check that all special characters are properly escaped in attributes
10991099 assert 'ampersand="Tom & Jerry"' in result
11001100 assert 'less_than="value < 10"' in result
11011101 assert 'greater_than="value > 5"' in result
11021102 assert 'quotes="He said "Hello""' in result
11031103 assert 'single_quotes="It's working"' in result
11041104 assert 'mixed="Tom & Jerry < 10 > 5 "quoted" 'apostrophe'"' in result
1105-
1105+
11061106 # Verify the element content is also properly escaped
11071107 assert ">content<" in result
11081108
@@ -1118,28 +1118,28 @@ def test_attrs_empty_and_none_values(self) -> None:
11181118 }
11191119 }
11201120 result = dicttoxml .dicttoxml (data , attr_type = False , item_wrap = False , root = False ).decode ('utf-8' )
1121-
1121+
11221122 assert 'empty=""' in result
1123- assert 'zero="0"' in result
1123+ assert 'zero="0"' in result
11241124 assert 'false="False"' in result
11251125
11261126 def test_make_attrstring_function_directly (self ) -> None :
11271127 """Test the make_attrstring function directly."""
11281128 from json2xml .dicttoxml import make_attrstring
1129-
1129+
11301130 # Test basic escaping
11311131 attrs = {
11321132 "test" : "value <here>" ,
1133- "ampersand" : "Tom & Jerry" ,
1133+ "ampersand" : "Tom & Jerry" ,
11341134 "quotes" : 'Say "hello"'
11351135 }
11361136 result = make_attrstring (attrs )
1137-
1137+
11381138 assert 'test="value <here>"' in result
11391139 assert 'ampersand="Tom & Jerry"' in result
11401140 assert 'quotes="Say "hello""' in result
1141-
1141+
11421142 # Test empty attributes
1143- empty_attrs = {}
1143+ empty_attrs : dict [ str , Any ] = {}
11441144 result = make_attrstring (empty_attrs )
11451145 assert result == ""
0 commit comments