def test_putInToC(self): """ L{tree.putInToC} replaces all of the children of the first node with the I{toc} class with the given node representing a table of contents. """ parent = dom.Element('div') toc = dom.Element('span') toc.setAttribute('class', 'toc') toc.appendChild(dom.Element('foo')) parent.appendChild(toc) tree.putInToC(parent, dom.Element('toc')) self.assertEqual(toc.toxml(), '<span class="toc"><toc/></span>')