Skip to content

Commit 8245728

Browse files
committed
Added a test demonstrating an issue with very deeply nested llsd maps.
1 parent 0931046 commit 8245728

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/llsd_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,20 @@ def testMap(self):
13451345
map_within_map_xml)
13461346
self.assertXMLRoundtrip({}, blank_map_xml)
13471347

1348+
def testDeepMap(self):
1349+
"""
1350+
Test that formatting a deeply nested map does not cause a RecursionError
1351+
"""
1352+
1353+
test_map = {"foo":"bar", "depth":0, "next":None}
1354+
max_depth = 200
1355+
for depth in range(max_depth):
1356+
test_map = {"foo":"bar", "depth":depth, "next":test_map}
1357+
1358+
# this should not throw an exception.
1359+
test_xml = self.llsd.as_xml(test_map)
1360+
1361+
13481362
def testBinary(self):
13491363
"""
13501364
Test the parse and serialization of input type : binary.

0 commit comments

Comments
 (0)