Fix invalid XML samples in tests that break with lxml 6. (#6919)

This commit is contained in:
Andrey Rakhmatullin 2025-06-27 16:05:02 +05:00 committed by GitHub
parent ff7795b159
commit eaae59fbef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -418,7 +418,7 @@ class CrawlSpiderWithParseMethod(MockServerSpider, CrawlSpider):
async def start(self):
test_body = b"""
<html>
<head><title>Page title<title></head>
<head><title>Page title</title></head>
<body>
<p><a href="/status?n=200">Item 200</a></p> <!-- callback -->
<p><a href="/status?n=201">Item 201</a></p> <!-- callback -->
@ -472,7 +472,7 @@ class CrawlSpiderWithErrback(CrawlSpiderWithParseMethod):
async def start(self):
test_body = b"""
<html>
<head><title>Page title<title></head>
<head><title>Page title</title></head>
<body>
<p><a href="/status?n=200">Item 200</a></p> <!-- callback -->
<p><a href="/status?n=201">Item 201</a></p> <!-- callback -->

View File

@ -152,7 +152,7 @@ class Base:
def test_nofollow(self):
"""Test the extractor's behaviour for links with rel='nofollow'"""
html = b"""<html><head><title>Page title<title>
html = b"""<html><head><title>Page title</title></head>
<body>
<div class='links'>
<p><a href="/about.html">About us</a></p>
@ -232,7 +232,7 @@ class Base:
def test_restrict_xpaths_encoding(self):
"""Test restrict_xpaths with encodings"""
html = b"""<html><head><title>Page title<title>
html = b"""<html><head><title>Page title</title></head>
<body><p><a href="item/12.html">Item 12</a></p>
<div class='links'>
<p><a href="/about.html">About us\xa3</a></p>
@ -378,7 +378,7 @@ class Base:
]
def test_base_url_with_restrict_xpaths(self):
html = b"""<html><head><title>Page title<title><base href="http://otherdomain.com/base/" />
html = b"""<html><head><title>Page title</title><base href="http://otherdomain.com/base/" /></head>
<body><p><a href="item/12.html">Item 12</a></p>
</body></html>"""
response = HtmlResponse("http://example.org/somepage/index.html", body=html)

View File

@ -234,7 +234,7 @@ class TestCSVFeedSpider(TestSpider):
class TestCrawlSpider(TestSpider):
test_body = b"""<html><head><title>Page title<title>
test_body = b"""<html><head><title>Page title</title></head>
<body>
<p><a href="item/12.html">Item 12</a></p>
<div class='links'>