From 560c32d330e53bbe03154ca6f55e3ed55675ccbb Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Fri, 1 Aug 2014 16:17:40 +0600 Subject: [PATCH] PY3 fix test_utils_sitemap. Sitemap class is only initialized with bytes by Scrapy; broken tests was only a testing issue. --- tests/py3-ignores.txt | 1 - tests/test_utils_sitemap.py | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txt index 7919f65f1..d1831c266 100644 --- a/tests/py3-ignores.txt +++ b/tests/py3-ignores.txt @@ -69,7 +69,6 @@ tests/test_utils_request.py tests/test_utils_response.py tests/test_utils_serialize.py tests/test_utils_signal.py -tests/test_utils_sitemap.py tests/test_utils_spider.py tests/test_utils_template.py tests/test_utils_url.py diff --git a/tests/test_utils_sitemap.py b/tests/test_utils_sitemap.py index 56585143f..bd2677956 100644 --- a/tests/test_utils_sitemap.py +++ b/tests/test_utils_sitemap.py @@ -5,7 +5,7 @@ from scrapy.utils.sitemap import Sitemap, sitemap_urls_from_robots class SitemapTest(unittest.TestCase): def test_sitemap(self): - s = Sitemap(""" + s = Sitemap(b""" http://www.example.com/ @@ -25,7 +25,7 @@ class SitemapTest(unittest.TestCase): [{'priority': '1', 'loc': 'http://www.example.com/', 'lastmod': '2009-08-16', 'changefreq': 'daily'}, {'priority': '0.8', 'loc': 'http://www.example.com/Special-Offers.html', 'lastmod': '2009-08-16', 'changefreq': 'weekly'}]) def test_sitemap_index(self): - s = Sitemap(""" + s = Sitemap(b""" http://www.example.com/sitemap1.xml.gz @@ -43,7 +43,7 @@ class SitemapTest(unittest.TestCase): """Assert we can deal with trailing spaces inside tags - we've seen those """ - s = Sitemap(""" + s = Sitemap(b""" http://www.example.com/ @@ -65,7 +65,7 @@ class SitemapTest(unittest.TestCase): def test_sitemap_wrong_ns(self): """We have seen sitemaps with wrongs ns. Presumably, Google still works with these, though is not 100% confirmed""" - s = Sitemap(""" + s = Sitemap(b""" http://www.example.com/ @@ -87,7 +87,7 @@ class SitemapTest(unittest.TestCase): def test_sitemap_wrong_ns2(self): """We have seen sitemaps with wrongs ns. Presumably, Google still works with these, though is not 100% confirmed""" - s = Sitemap(""" + s = Sitemap(b""" http://www.example.com/ @@ -129,7 +129,7 @@ Disallow: /forum/active/ def test_sitemap_blanklines(self): """Assert we can deal with starting blank lines before tag""" - s = Sitemap("""\ + s = Sitemap(b"""\ @@ -160,7 +160,7 @@ Disallow: /forum/active/ ]) def test_comment(self): - s = Sitemap(""" + s = Sitemap(b""" @@ -174,7 +174,7 @@ Disallow: /forum/active/ ]) def test_alternate(self): - s = Sitemap(""" + s = Sitemap(b""" @@ -196,7 +196,7 @@ Disallow: /forum/active/ ]) def test_xml_entity_expansion(self): - s = Sitemap(""" + s = Sitemap(b"""