Moved yesno filter test to its file.

This commit is contained in:
Hasan Ramezani 2018-07-28 01:45:00 +04:30 committed by Tim Graham
parent e7a56eb4f0
commit cebbcaa1ba
2 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,15 @@
from django.template.defaultfilters import yesno from django.template.defaultfilters import yesno
from django.test import SimpleTestCase from django.test import SimpleTestCase
from ..utils import setup
class YesNoTests(SimpleTestCase):
@setup({'t': '{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}'})
def test_true(self):
output = self.engine.render_to_string('t', {'var': True})
self.assertEqual(output, 'yup yes')
class FunctionTests(SimpleTestCase): class FunctionTests(SimpleTestCase):

View File

@ -109,14 +109,6 @@ class FilterSyntaxTests(SimpleTestCase):
output = self.engine.render_to_string('filter-syntax11', {"var": None, "var2": "happy"}) output = self.engine.render_to_string('filter-syntax11', {"var": None, "var2": "happy"})
self.assertEqual(output, 'happy') self.assertEqual(output, 'happy')
@setup({'filter-syntax12': r'{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}'})
def test_filter_syntax12(self):
"""
Default argument testing
"""
output = self.engine.render_to_string('filter-syntax12', {"var": True})
self.assertEqual(output, 'yup yes')
@setup({'filter-syntax13': r'1{{ var.method3 }}2'}) @setup({'filter-syntax13': r'1{{ var.method3 }}2'})
def test_filter_syntax13(self): def test_filter_syntax13(self):
""" """