summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests/test_generic.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-04 08:08:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch)
treefa50869f5614295f462d9bf77fec59365c621609 /tests/sitemaps_tests/test_generic.py
parent9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff)
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'tests/sitemaps_tests/test_generic.py')
-rw-r--r--tests/sitemaps_tests/test_generic.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/sitemaps_tests/test_generic.py b/tests/sitemaps_tests/test_generic.py
index 33a8ee5592..2865c77902 100644
--- a/tests/sitemaps_tests/test_generic.py
+++ b/tests/sitemaps_tests/test_generic.py
@@ -40,24 +40,25 @@ class GenericViewsSitemapTests(SitemapTestsBase):
for pk in TestModel.objects.values_list("id", flat=True):
expected += "<url><loc>%s/testmodel/%s/</loc></url>" % (self.base_url, pk)
expected_content = (
- """<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-%s
-</urlset>
-"""
- % expected
- )
+ '<?xml version="1.0" encoding="UTF-8"?>\n'
+ '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" '
+ 'xmlns:xhtml="http://www.w3.org/1999/xhtml">\n'
+ "%s\n"
+ "</urlset>"
+ ) % expected
self.assertXMLEqual(response.content.decode(), expected_content)
def test_generic_sitemap_lastmod(self):
test_model = TestModel.objects.first()
TestModel.objects.update(lastmod=datetime(2013, 3, 13, 10, 0, 0))
response = self.client.get("/generic-lastmod/sitemap.xml")
- expected_content = """<?xml version="1.0" encoding="UTF-8"?>
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
-<url><loc>%s/testmodel/%s/</loc><lastmod>2013-03-13</lastmod></url>
-</urlset>
-""" % (
+ expected_content = (
+ '<?xml version="1.0" encoding="UTF-8"?>\n'
+ '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" '
+ 'xmlns:xhtml="http://www.w3.org/1999/xhtml">\n'
+ "<url><loc>%s/testmodel/%s/</loc><lastmod>2013-03-13</lastmod></url>\n"
+ "</urlset>"
+ ) % (
self.base_url,
test_model.pk,
)