From e92b057e06b41eb05930637119e83ed3acd3d324 Mon Sep 17 00:00:00 2001 From: Jaap Roes Date: Mon, 11 Aug 2014 09:51:52 +0200 Subject: Fixed #23261 -- Deprecated old style list support for unordered_list filter. --- tests/defaultfilters/tests.py | 26 +++++++++++++++----------- tests/template_tests/tests.py | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py index 22dc04666e..c9aa79cdb5 100644 --- a/tests/defaultfilters/tests.py +++ b/tests/defaultfilters/tests.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import datetime import decimal import unittest +import warnings from django.template.defaultfilters import ( add, addslashes, capfirst, center, cut, date, default, default_if_none, @@ -549,20 +550,23 @@ class DefaultFiltersTests(TestCase): self.assertEqual(unordered_list([a, b]), '\t
  • ulitem-a
  • \n\t
  • ulitem-b
  • ') # Old format for unordered lists should still work - self.assertEqual(unordered_list(['item 1', []]), '\t
  • item 1
  • ') + with warnings.catch_warnings(record=True): + warnings.simplefilter("always") - self.assertEqual(unordered_list(['item 1', [['item 1.1', []]]]), - '\t
  • item 1\n\t\n\t
  • ') + self.assertEqual(unordered_list(['item 1', []]), '\t
  • item 1
  • ') + + self.assertEqual(unordered_list(['item 1', [['item 1.1', []]]]), + '\t
  • item 1\n\t\n\t
  • ') - self.assertEqual(unordered_list(['item 1', [['item 1.1', []], - ['item 1.2', []]]]), '\t
  • item 1\n\t\n\t
  • ') + self.assertEqual(unordered_list(['item 1', [['item 1.1', []], + ['item 1.2', []]]]), '\t
  • item 1\n\t\n\t
  • ') - self.assertEqual(unordered_list(['States', [['Kansas', [['Lawrence', - []], ['Topeka', []]]], ['Illinois', []]]]), '\t
  • States\n\t' - '\n\t
  • ') + self.assertEqual(unordered_list(['States', [['Kansas', [['Lawrence', + []], ['Topeka', []]]], ['Illinois', []]]]), '\t
  • States\n\t' + '\n\t
  • ') def test_add(self): self.assertEqual(add('1', '2'), 3) diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index d5ee85fce2..c24040ebfe 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -590,6 +590,8 @@ class TemplateTests(TestCase): # Ignore deprecations of using the wrong number of variables with the 'for' tag. # and warnings for {% url %} reversing by dotted path warnings.filterwarnings("ignore", category=RemovedInDjango20Warning, module="django.template.defaulttags") + # Ignore deprecations of old style unordered_list. + warnings.filterwarnings("ignore", category=RemovedInDjango20Warning, module="django.template.defaultfilters") output = self.render(test_template, vals) except ShouldNotExecuteException: failures.append("Template test (Cached='%s', TEMPLATE_STRING_IF_INVALID='%s', TEMPLATE_DEBUG=%s): %s -- FAILED. Template rendering invoked method that shouldn't have been invoked." % (is_cached, invalid_str, template_debug, name)) -- cgit v1.3