mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #21267 -- Fixed E502 pep8 warnings
This commit is contained in:
parent
dfb4cb9970
commit
65d1d65d52
11 changed files with 46 additions and 46 deletions
|
@ -124,7 +124,7 @@ class DefaultFiltersTests(TestCase):
|
|||
self.assertEqual(linenumbers('line 1\nline 2'),
|
||||
'1. line 1\n2. line 2')
|
||||
self.assertEqual(linenumbers('\n'.join(['x'] * 10)),
|
||||
'01. x\n02. x\n03. x\n04. x\n05. x\n06. x\n07. '\
|
||||
'01. x\n02. x\n03. x\n04. x\n05. x\n06. x\n07. '
|
||||
'x\n08. x\n09. x\n10. x')
|
||||
|
||||
def test_lower(self):
|
||||
|
@ -138,7 +138,7 @@ class DefaultFiltersTests(TestCase):
|
|||
self.assertEqual(make_list(1234), ['1', '2', '3', '4'])
|
||||
|
||||
def test_slugify(self):
|
||||
self.assertEqual(slugify(' Jack & Jill like numbers 1,2,3 and 4 and'\
|
||||
self.assertEqual(slugify(' Jack & Jill like numbers 1,2,3 and 4 and'
|
||||
' silly characters ?%.$!/'),
|
||||
'jack-jill-like-numbers-123-and-4-and-silly-characters')
|
||||
|
||||
|
@ -170,7 +170,7 @@ class DefaultFiltersTests(TestCase):
|
|||
def test_truncatewords_html(self):
|
||||
self.assertEqual(truncatewords_html(
|
||||
'<p>one <a href="#">two - three <br>four</a> five</p>', 0), '')
|
||||
self.assertEqual(truncatewords_html('<p>one <a href="#">two - '\
|
||||
self.assertEqual(truncatewords_html('<p>one <a href="#">two - '
|
||||
'three <br>four</a> five</p>', 2),
|
||||
'<p>one <a href="#">two ...</a></p>')
|
||||
self.assertEqual(truncatewords_html(
|
||||
|
@ -205,17 +205,17 @@ class DefaultFiltersTests(TestCase):
|
|||
'fran%C3%A7ois%20%26%20jill')
|
||||
|
||||
def test_urlizetrunc(self):
|
||||
self.assertEqual(urlizetrunc('http://short.com/', 20), '<a href='\
|
||||
self.assertEqual(urlizetrunc('http://short.com/', 20), '<a href='
|
||||
'"http://short.com/" rel="nofollow">http://short.com/</a>')
|
||||
|
||||
self.assertEqual(urlizetrunc('http://www.google.co.uk/search?hl=en'\
|
||||
'&q=some+long+url&btnG=Search&meta=', 20), '<a href="http://'\
|
||||
'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&'\
|
||||
self.assertEqual(urlizetrunc('http://www.google.co.uk/search?hl=en'
|
||||
'&q=some+long+url&btnG=Search&meta=', 20), '<a href="http://'
|
||||
'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&'
|
||||
'meta=" rel="nofollow">http://www.google...</a>')
|
||||
|
||||
self.assertEqual(urlizetrunc('http://www.google.co.uk/search?hl=en'\
|
||||
'&q=some+long+url&btnG=Search&meta=', 20), '<a href="http://'\
|
||||
'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search'\
|
||||
self.assertEqual(urlizetrunc('http://www.google.co.uk/search?hl=en'
|
||||
'&q=some+long+url&btnG=Search&meta=', 20), '<a href="http://'
|
||||
'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search'
|
||||
'&meta=" rel="nofollow">http://www.google...</a>')
|
||||
|
||||
# Check truncating of URIs which are the exact length
|
||||
|
@ -223,15 +223,15 @@ class DefaultFiltersTests(TestCase):
|
|||
self.assertEqual(len(uri), 31)
|
||||
|
||||
self.assertEqual(urlizetrunc(uri, 31),
|
||||
'<a href="http://31characteruri.com/test/" rel="nofollow">'\
|
||||
'<a href="http://31characteruri.com/test/" rel="nofollow">'
|
||||
'http://31characteruri.com/test/</a>')
|
||||
|
||||
self.assertEqual(urlizetrunc(uri, 30),
|
||||
'<a href="http://31characteruri.com/test/" rel="nofollow">'\
|
||||
'<a href="http://31characteruri.com/test/" rel="nofollow">'
|
||||
'http://31characteruri.com/t...</a>')
|
||||
|
||||
self.assertEqual(urlizetrunc(uri, 2),
|
||||
'<a href="http://31characteruri.com/test/"'\
|
||||
'<a href="http://31characteruri.com/test/"'
|
||||
' rel="nofollow">...</a>')
|
||||
|
||||
def test_urlize(self):
|
||||
|
@ -350,18 +350,18 @@ class DefaultFiltersTests(TestCase):
|
|||
self.assertEqual(wordcount('oneword'), 1)
|
||||
self.assertEqual(wordcount('lots of words'), 3)
|
||||
|
||||
self.assertEqual(wordwrap('this is a long paragraph of text that '\
|
||||
self.assertEqual(wordwrap('this is a long paragraph of text that '
|
||||
'really needs to be wrapped I\'m afraid', 14),
|
||||
"this is a long\nparagraph of\ntext that\nreally needs\nto be "\
|
||||
"this is a long\nparagraph of\ntext that\nreally needs\nto be "
|
||||
"wrapped\nI'm afraid")
|
||||
|
||||
self.assertEqual(wordwrap('this is a short paragraph of text.\n '\
|
||||
self.assertEqual(wordwrap('this is a short paragraph of text.\n '
|
||||
'But this line should be indented', 14),
|
||||
'this is a\nshort\nparagraph of\ntext.\n But this\nline '\
|
||||
'this is a\nshort\nparagraph of\ntext.\n But this\nline '
|
||||
'should be\nindented')
|
||||
|
||||
self.assertEqual(wordwrap('this is a short paragraph of text.\n '\
|
||||
'But this line should be indented',15), 'this is a short\n'\
|
||||
self.assertEqual(wordwrap('this is a short paragraph of text.\n '
|
||||
'But this line should be indented',15), 'this is a short\n'
|
||||
'paragraph of\ntext.\n But this line\nshould be\nindented')
|
||||
|
||||
def test_rjust(self):
|
||||
|
@ -388,7 +388,7 @@ class DefaultFiltersTests(TestCase):
|
|||
self.assertIsInstance(escaped, SafeData)
|
||||
self.assertEqual(
|
||||
force_escape('<some html & special characters > here ĐÅ€£'),
|
||||
'<some html & special characters > here'\
|
||||
'<some html & special characters > here'
|
||||
' \u0110\xc5\u20ac\xa3')
|
||||
|
||||
def test_linebreaks(self):
|
||||
|
@ -409,10 +409,10 @@ class DefaultFiltersTests(TestCase):
|
|||
'line 1<br />line 2')
|
||||
|
||||
def test_removetags(self):
|
||||
self.assertEqual(removetags('some <b>html</b> with <script>alert'\
|
||||
self.assertEqual(removetags('some <b>html</b> with <script>alert'
|
||||
'("You smell")</script> disallowed <img /> tags', 'script img'),
|
||||
'some <b>html</b> with alert("You smell") disallowed tags')
|
||||
self.assertEqual(striptags('some <b>html</b> with <script>alert'\
|
||||
self.assertEqual(striptags('some <b>html</b> with <script>alert'
|
||||
'("You smell")</script> disallowed <img /> tags'),
|
||||
'some html with alert("You smell") disallowed tags')
|
||||
|
||||
|
@ -483,20 +483,20 @@ class DefaultFiltersTests(TestCase):
|
|||
|
||||
self.assertEqual(
|
||||
unordered_list(['item 1', ['item 1.1', 'item1.2'], 'item 2']),
|
||||
'\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1</li>\n\t\t<li>item1.2'\
|
||||
'\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1</li>\n\t\t<li>item1.2'
|
||||
'</li>\n\t</ul>\n\t</li>\n\t<li>item 2</li>')
|
||||
|
||||
self.assertEqual(
|
||||
unordered_list(['item 1', ['item 1.1', ['item 1.1.1',
|
||||
['item 1.1.1.1']]]]),
|
||||
'\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1\n\t\t<ul>\n\t\t\t<li>'\
|
||||
'item 1.1.1\n\t\t\t<ul>\n\t\t\t\t<li>item 1.1.1.1</li>\n\t\t\t'\
|
||||
'\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1\n\t\t<ul>\n\t\t\t<li>'
|
||||
'item 1.1.1\n\t\t\t<ul>\n\t\t\t\t<li>item 1.1.1.1</li>\n\t\t\t'
|
||||
'</ul>\n\t\t\t</li>\n\t\t</ul>\n\t\t</li>\n\t</ul>\n\t</li>')
|
||||
|
||||
self.assertEqual(unordered_list(
|
||||
['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]),
|
||||
'\t<li>States\n\t<ul>\n\t\t<li>Kansas\n\t\t<ul>\n\t\t\t<li>'\
|
||||
'Lawrence</li>\n\t\t\t<li>Topeka</li>\n\t\t</ul>\n\t\t</li>'\
|
||||
'\t<li>States\n\t<ul>\n\t\t<li>Kansas\n\t\t<ul>\n\t\t\t<li>'
|
||||
'Lawrence</li>\n\t\t\t<li>Topeka</li>\n\t\t</ul>\n\t\t</li>'
|
||||
'\n\t\t<li>Illinois</li>\n\t</ul>\n\t</li>')
|
||||
|
||||
@python_2_unicode_compatible
|
||||
|
@ -518,13 +518,13 @@ class DefaultFiltersTests(TestCase):
|
|||
'\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1</li>\n\t</ul>\n\t</li>')
|
||||
|
||||
self.assertEqual(unordered_list(['item 1', [['item 1.1', []],
|
||||
['item 1.2', []]]]), '\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1'\
|
||||
['item 1.2', []]]]), '\t<li>item 1\n\t<ul>\n\t\t<li>item 1.1'
|
||||
'</li>\n\t\t<li>item 1.2</li>\n\t</ul>\n\t</li>')
|
||||
|
||||
self.assertEqual(unordered_list(['States', [['Kansas', [['Lawrence',
|
||||
[]], ['Topeka', []]]], ['Illinois', []]]]), '\t<li>States\n\t'\
|
||||
'<ul>\n\t\t<li>Kansas\n\t\t<ul>\n\t\t\t<li>Lawrence</li>'\
|
||||
'\n\t\t\t<li>Topeka</li>\n\t\t</ul>\n\t\t</li>\n\t\t<li>'\
|
||||
[]], ['Topeka', []]]], ['Illinois', []]]]), '\t<li>States\n\t'
|
||||
'<ul>\n\t\t<li>Kansas\n\t\t<ul>\n\t\t\t<li>Lawrence</li>'
|
||||
'\n\t\t\t<li>Topeka</li>\n\t\t</ul>\n\t\t</li>\n\t\t<li>'
|
||||
'Illinois</li>\n\t</ul>\n\t</li>')
|
||||
|
||||
def test_add(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue