source: pyyaml/trunk/tests/test_recursive.py @ 142

Revision 142, 440 bytes checked in by xi, 8 years ago (diff)

Add support for recursive nodes to Composer. Constructor does not support recursive objects though.

RevLine 
[142]1
2import unittest
3from yaml import *
4
5RECURSIVE = """
6--- &A
7- *A: *A
8"""
9
10class TestRecursive(unittest.TestCase):
11
12    def testRecursive(self):
13        node = compose(RECURSIVE)
14        self._check(node)
15        document = serialize(node)
16        node = compose(document)
17        self._check(node)
18
19    def _check(self, node):
20        self.failUnless(node in node.value[0].value)
21        self.failUnless(node.value[0].value[node] is node)
22
Note: See TracBrowser for help on using the repository browser.