def test_18(): xml1 = et.fromstring('<a>Hello and Good bye!</a>') xml2 = et.fromstring('<a>Hello and</a>') with pytest.raises( RuntimeError, match="Master document has longer text than the slave.*"): fuse(xml1, xml2, prefer_slave_inner=False, auto_segment=False)
def test_16(): xml1 = et.fromstring('<a>Hello and Bye</a>') xml2 = et.fromstring('<a>Hello and Good bye!</a>') with pytest.raises( RuntimeError, match="Input documents have different text at offset 10"): fuse(xml1, xml2, prefer_slave_inner=False, auto_segment=False)
def test_07(): xml1 = et.fromstring('<a><b>Hello, w</b>orld</a>') xml2 = et.fromstring('<a>Hello, <i>world</i></a>') merged = fuse(xml1, xml2) result = et.tostring(merged) model = b'<a><b>Hello, <i>w</i></b><i>orld</i></a>' if model != result: print(model) print(result) assert False
def test_14(): xml1 = et.fromstring('<a><b>Hello</b>, world</a>') xml2 = et.fromstring('<a>Hello,<!-- Hey Jude! --> <i>world</i></a>') merged = fuse(xml1, xml2, prefer_slave_inner=False) result = et.tostring(merged) model = b'<a><b>Hello</b>,<!-- Hey Jude! --> <i>world</i></a>' if model != result: print(model) print(result) assert False
def test_12(): xml1 = et.fromstring('<a><b>Hello</b>,<br/> world</a>') xml2 = et.fromstring('<a><br><img/></br><i>Hello</i>, <i>world</i></a>') merged = fuse(xml1, xml2, prefer_slave_inner=False) result = et.tostring(merged) model = b'<a><br><img/></br><i><b>Hello</b></i>,<br/> <i>world</i></a>' if model != result: print(model) print(result) assert False
def test_15(): xml1 = et.fromstring('<a><b>12345</b>67890</a>') xml2 = et.fromstring('<a>123<i>4567890</i></a>') with pytest.raises(RuntimeError, match="Conflicting markup"): fuse(xml1, xml2, prefer_slave_inner=False, auto_segment=False)