def test_combine(self): docs = [ XMLFeatureInfoDoc('<root><a>foo</a></root>'), XMLFeatureInfoDoc('<root><b>bar</b></root>'), XMLFeatureInfoDoc('<other_root><a>baz</a></other_root>'), ] result = XMLFeatureInfoDoc.combine(docs) eq_(strip_whitespace(result.as_string()), strip_whitespace(b'<root><a>foo</a><b>bar</b><a>baz</a></root>')) eq_(result.info_type, 'xml')
def test_combine(self): docs = [ XMLFeatureInfoDoc(b'<root><a>foo</a></root>'), XMLFeatureInfoDoc(b'<root><b>bar</b></root>'), XMLFeatureInfoDoc(b'<other_root><a>baz</a></other_root>'), ] result = XMLFeatureInfoDoc.combine(docs) eq_(b'<root><a>foo</a></root>\n<root><b>bar</b></root>\n<other_root><a>baz</a></other_root>', result.as_string()) eq_(result.info_type, 'text')
def test_combine(self): docs = [ XMLFeatureInfoDoc("<root><a>foo</a></root>"), XMLFeatureInfoDoc("<root><b>bar</b></root>"), XMLFeatureInfoDoc("<other_root><a>baz</a></other_root>"), ] result = XMLFeatureInfoDoc.combine(docs) assert strip_whitespace(result.as_string()) == strip_whitespace( b"<root><a>foo</a><b>bar</b><a>baz</a></root>") assert result.info_type == "xml"
def test_combine(self): docs = [ XMLFeatureInfoDoc(b"<root><a>foo</a></root>"), XMLFeatureInfoDoc(b"<root><b>bar</b></root>"), XMLFeatureInfoDoc(b"<other_root><a>baz</a></other_root>"), ] result = XMLFeatureInfoDoc.combine(docs) assert ( b"<root><a>foo</a></root>\n<root><b>bar</b></root>\n<other_root><a>baz</a></other_root>" == result.as_string()) assert result.info_type == "text"
def test_multiple(self): t = XSLTransformer(self.xsl_script) doc = t.transform(XMLFeatureInfoDoc.combine([ XMLFeatureInfoDoc(x) for x in [b'<a><b>ab</b></a>', b'<a><b>ab1</b><b>ab2</b><b>ab3</b></a>', b'<a><b>ab1</b><c>ac</c><b>ab2</b></a>', ]])) eq_(strip_whitespace(doc.as_string()), strip_whitespace(b''' <root> <foo>ab</foo> <foo>ab1</foo><foo>ab2</foo><foo>ab3</foo> <foo>ab1</foo><foo>ab2</foo> </root>''')) eq_(doc.info_type, 'xml')
def test_multiple(self): t = XSLTransformer(self.xsl_script) doc = t.transform( XMLFeatureInfoDoc.combine([ XMLFeatureInfoDoc(x) for x in [ b"<a><b>ab</b></a>", b"<a><b>ab1</b><b>ab2</b><b>ab3</b></a>", b"<a><b>ab1</b><c>ac</c><b>ab2</b></a>", ] ])) assert strip_whitespace(doc.as_string()) == strip_whitespace(b""" <root> <foo>ab</foo> <foo>ab1</foo><foo>ab2</foo><foo>ab3</foo> <foo>ab1</foo><foo>ab2</foo> </root>""") assert doc.info_type == "xml"