File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ def _ARRAY(self, v):
119
119
self ._indent ()
120
120
self ._generate (item )
121
121
self ._depth -= 1
122
+ self ._indent ()
122
123
self .stream .writelines ([b'</array>' , self ._eol ])
123
124
def _MAP (self , v ):
124
125
self .stream .writelines ([b'<map>' , self ._eol ])
Original file line number Diff line number Diff line change @@ -1503,6 +1503,24 @@ def testFormatPrettyXML(self):
1503
1503
1504
1504
output_xml = llsd .format_pretty_xml (python_object )
1505
1505
1506
+ with open ("foo.llsd.xml" , "wb" ) as f :
1507
+ f .write (output_xml )
1508
+
1509
+ self .assertEqual (output_xml .decode ("utf8" ), """<?xml version="1.0" ?>
1510
+ <llsd>
1511
+ <map>
1512
+ <key>id</key>
1513
+ <array>
1514
+ <string>string1</string>
1515
+ <integer>123</integer>
1516
+ <map>
1517
+ <key>name</key>
1518
+ <integer>123</integer>
1519
+ </map>
1520
+ </array>
1521
+ </map>
1522
+ </llsd>""" )
1523
+
1506
1524
# check whether the output_xml contains whitespaces and new line character
1507
1525
whitespaces_count = output_xml .count (b' ' )
1508
1526
newline_count = output_xml .count (b'\n ' )
@@ -1944,3 +1962,5 @@ def test_uuid_map_key(self):
1944
1962
llsdmap = llsd .LLSD ({uuid .UUID (int = 0 ) : 'uuid' })
1945
1963
self .assertEqual (llsd .format_xml (llsdmap ), b'<?xml version="1.0" ?><llsd><map><key>00000000-0000-0000-0000-000000000000</key><string>uuid</string></map></llsd>' )
1946
1964
self .assertEqual (llsd .format_notation (llsdmap ), b"{'00000000-0000-0000-0000-000000000000':'uuid'}" )
1965
+
1966
+
You can’t perform that action at this time.
0 commit comments