This bug was fixed in the package beautifulsoup4 - 4.13.4-3 --------------- beautifulsoup4 (4.13.4-3) experimental; urgency=medium
* Patch: Compatibility with libxml2 2.14.3, in tests. (LP: #2112242) -- Stefano Rivera <[email protected]> Mon, 09 Jun 2025 11:58:22 +0200 ** Changed in: beautifulsoup4 (Ubuntu) Status: New => Fix Released -- You received this bug notification because you are a member of Debcrafters packages, which is subscribed to beautifulsoup4 in Ubuntu. https://bugs.launchpad.net/bugs/2112242 Title: Some tests fail with libxml 2.14.3 Status in Beautiful Soup: Fix Committed Status in beautifulsoup4 package in Ubuntu: Fix Released Bug description: Hi! With libxml 2.14.3, it seems three tests (test_real_xhtml_document, test_processing_instruction, and test_out_of_range_entity) now fail. This is the case on x86_64-linux and aarch64-linux (NixOS). Logs: ============================= test session starts ============================== platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.6.0 rootdir: /build/beautifulsoup4-4.13.4 configfile: pyproject.toml collected 851 items ... =================================== FAILURES =================================== _________________ TestLXMLTreeBuilder.test_real_xhtml_document _________________ self = <bs4.tests.test_lxml.TestLXMLTreeBuilder object at 0xfffff4630050> def test_real_xhtml_document(self): """A real XHTML document should come out more or less the same as it went in.""" markup = b"""<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>Hello.</title></head> <body>Goodbye.</body> </html>""" with warnings.catch_warnings(record=True) as w: soup = self.soup(markup) > assert soup.encode("utf-8").replace(b"\n", b"") == markup.replace(b"\n", b"") E AssertionError bs4/tests/__init__.py:529: AssertionError _______________ TestLXMLTreeBuilder.test_processing_instruction ________________ self = <bs4.tests.test_lxml.TestLXMLTreeBuilder object at 0xfffff45cf610> def test_processing_instruction(self): # We test both Unicode and bytestring to verify that # process_markup correctly sets processing_instruction_class # even when the markup is already Unicode and there is no # need to process anything. markup = """<?PITarget PIContent?>""" soup = self.soup(markup) > assert markup == soup.decode() E AssertionError bs4/tests/__init__.py:571: AssertionError _________________ TestLXMLTreeBuilder.test_out_of_range_entity _________________ self = <bs4.tests.test_lxml.TestLXMLTreeBuilder object at 0xfffff4b4b890> def test_out_of_range_entity(self): > self.assert_soup("<p>foo�bar</p>", "<p>foobar</p>") bs4/tests/test_lxml.py:33: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <bs4.tests.test_lxml.TestLXMLTreeBuilder object at 0xfffff4b4b890> to_parse = '<p>foo�bar</p>', compare_parsed_to = '<p>foobar</p>' def assert_soup( self, to_parse: _IncomingMarkup, compare_parsed_to: Optional[str] = None ) -> None: """Parse some markup using Beautiful Soup and verify that the output markup is as expected. """ builder = self.default_builder obj = BeautifulSoup(to_parse, builder=builder) if compare_parsed_to is None: assert isinstance(to_parse, str) compare_parsed_to = to_parse # Verify that the documents come out the same. > assert obj.decode() == self.document_for(compare_parsed_to) E AssertionError bs4/tests/__init__.py:131: AssertionError =========================== short test summary info ============================ FAILED bs4/tests/test_lxml.py::TestLXMLTreeBuilder::test_real_xhtml_document - AssertionError FAILED bs4/tests/test_lxml.py::TestLXMLTreeBuilder::test_processing_instruction - AssertionError FAILED bs4/tests/test_lxml.py::TestLXMLTreeBuilder::test_out_of_range_entity - AssertionError =================== 3 failed, 841 passed, 7 skipped in 2.62s =================== To manage notifications about this bug go to: https://bugs.launchpad.net/beautifulsoup/+bug/2112242/+subscriptions -- Mailing list: https://launchpad.net/~debcrafters-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~debcrafters-packages More help : https://help.launchpad.net/ListHelp

