repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/tests.py
tests/template_tests/tests.py
import sys from django.template import Context, Engine, TemplateDoesNotExist, TemplateSyntaxError from django.template.base import UNKNOWN_SOURCE from django.test import SimpleTestCase, override_settings from django.urls import NoReverseMatch from django.utils import translation class TemplateTestMixin: def _eng...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_partials.py
tests/template_tests/test_partials.py
import os from unittest import mock from django.http import HttpResponse from django.template import ( Context, NodeList, Origin, PartialTemplate, Template, TemplateDoesNotExist, TemplateSyntaxError, engines, ) from django.template.backends.django import DjangoTemplates from django.temp...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_autoreloader.py
tests/template_tests/test_autoreloader.py
from pathlib import Path from unittest import mock from django.template import autoreload from django.test import SimpleTestCase, override_settings from django.test.utils import require_jinja2 ROOT = Path(__file__).parent.absolute() EXTRA_TEMPLATES_DIR = ROOT / "templates_extra" @override_settings( INSTALLED_AP...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/test_smartif.py
tests/template_tests/test_smartif.py
import unittest from django.template.smartif import IfParser class SmartIfTests(unittest.TestCase): def assertCalcEqual(self, expected, tokens): self.assertEqual(expected, IfParser(tokens).parse().eval({})) # We only test things here that are difficult to test elsewhere # Many other tests are fo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/urls.py
tests/template_tests/urls.py
from django.urls import include, path, re_path from . import views ns_patterns = [ # Test urls for testing reverse lookups path("", views.index, name="index"), re_path(r"^client/([0-9,]+)/$", views.client, name="client"), re_path( r"^client/(?P<id>[0-9]+)/(?P<action>[^/]+)/$", views.cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/bad_tag.py
tests/template_tests/templatetags/bad_tag.py
from django import template register = template.Library() @register.tag def badtag(parser, token): raise RuntimeError("I am a bad tag") @register.simple_tag def badsimpletag(): raise RuntimeError("I am a bad simpletag")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/tag_27584.py
tests/template_tests/templatetags/tag_27584.py
from django import template register = template.Library() @register.tag def badtag(parser, token): parser.parse(("endbadtag",)) parser.delete_first_token() return BadNode() class BadNode(template.Node): def render(self, context): raise template.TemplateSyntaxError("error")
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/__init__.py
tests/template_tests/templatetags/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/testtags.py
tests/template_tests/templatetags/testtags.py
from django.template import Library, Node register = Library() class EchoNode(Node): def __init__(self, contents): self.contents = contents def render(self, context): return " ".join(self.contents) @register.tag def echo(parser, token): return EchoNode(token.contents.split()[1:]) reg...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/custom.py
tests/template_tests/templatetags/custom.py
from django import template from django.template.base import TextNode from django.template.defaultfilters import stringfilter from django.utils.html import escape, format_html from django.utils.safestring import mark_safe register = template.Library() @register.filter @stringfilter def trim(value, num): return v...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/inclusion.py
tests/template_tests/templatetags/inclusion.py
from django.template import Engine, Library engine = Engine(app_dirs=True) register = Library() @register.inclusion_tag("inclusion.html") def inclusion_no_params(): """Expected inclusion_no_params __doc__""" return {"result": "inclusion_no_params - Expected result"} inclusion_no_params.anything = "Expected...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/subpackage/echo.py
tests/template_tests/templatetags/subpackage/echo.py
from django import template register = template.Library() @register.simple_tag def echo2(arg): return arg
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/templatetags/subpackage/__init__.py
tests/template_tests/templatetags/subpackage/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_linebreaks.py
tests/template_tests/filter_tests/test_linebreaks.py
from django.template.defaultfilters import linebreaks_filter from django.test import SimpleTestCase from django.utils.functional import lazy from django.utils.safestring import mark_safe from ..utils import setup class LinebreaksTests(SimpleTestCase): """ The contents in "linebreaks" are escaped according to...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_urlize.py
tests/template_tests/filter_tests/test_urlize.py
from unittest import mock from django.template.defaultfilters import urlize from django.test import SimpleTestCase from django.test.utils import override_settings from django.utils.functional import lazy from django.utils.html import Urlizer from django.utils.safestring import mark_safe from ..utils import setup cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_time.py
tests/template_tests/filter_tests/test_time.py
from datetime import time from django.template.defaultfilters import time as time_filter from django.test import SimpleTestCase from django.utils import timezone, translation from ..utils import setup from .timezone_utils import TimezoneTestCase class TimeTests(TimezoneTestCase): """ #20693: Timezone suppor...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_join.py
tests/template_tests/filter_tests/test_join.py
from django.template.defaultfilters import join from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class JoinTests(SimpleTestCase): @setup({"join01": '{{ a|join:", " }}'}) def test_join01(self): output = self.engine.render_to_string("join01"...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_force_escape.py
tests/template_tests/filter_tests/test_force_escape.py
from django.template.defaultfilters import force_escape from django.test import SimpleTestCase from django.utils.safestring import SafeData from ..utils import setup class ForceEscapeTests(SimpleTestCase): """ Force_escape is applied immediately. It can be used to provide double-escaping, for example. ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_divisibleby.py
tests/template_tests/filter_tests/test_divisibleby.py
from django.template.defaultfilters import divisibleby from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_true(self): self.assertIs(divisibleby(4, 2), True) def test_false(self): self.assertIs(divisibleby(4, 3), False)
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_upper.py
tests/template_tests/filter_tests/test_upper.py
from django.template.defaultfilters import upper from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class UpperTests(SimpleTestCase): """ The "upper" filter messes up entities (which are case-sensitive), so it's not safe for non-escaping purpose...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_first.py
tests/template_tests/filter_tests/test_first.py
from django.template.defaultfilters import first from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class FirstTests(SimpleTestCase): @setup({"first01": "{{ a|first }} {{ b|first }}"}) def test_first01(self): output = self.engine.render_to_s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_yesno.py
tests/template_tests/filter_tests/test_yesno.py
from django.template.defaultfilters import yesno 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}) sel...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_escapejs.py
tests/template_tests/filter_tests/test_escapejs.py
from django.template.defaultfilters import escapejs_filter from django.test import SimpleTestCase from django.utils.functional import lazy from ..utils import setup class EscapejsTests(SimpleTestCase): @setup({"escapejs01": "{{ a|escapejs }}"}) def test_escapejs01(self): output = self.engine.render_t...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_unordered_list.py
tests/template_tests/filter_tests/test_unordered_list.py
from django.template.defaultfilters import unordered_list from django.test import SimpleTestCase from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy from ..utils import setup class UnorderedListTests(SimpleTestCase): @setup({"unordered_list01": "{{ a|unordered_list }}"...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_add.py
tests/template_tests/filter_tests/test_add.py
from datetime import date, timedelta from django.template.defaultfilters import add from django.test import SimpleTestCase from django.utils.translation import gettext_lazy from ..utils import setup class AddTests(SimpleTestCase): """ Tests for #11687 and #16676 """ @setup({"add01": '{{ i|add:"5" }...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_iriencode.py
tests/template_tests/filter_tests/test_iriencode.py
from django.template.defaultfilters import iriencode, urlencode from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class IriencodeTests(SimpleTestCase): """ Ensure iriencode keeps safe strings. """ @setup({"iriencode01": "{{ url|iriencode }...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_random.py
tests/template_tests/filter_tests/test_random.py
from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class RandomTests(SimpleTestCase): @setup({"random01": "{{ a|random }} {{ b|random }}"}) def test_random01(self): output = self.engine.render_to_string( "random01", {"a": ["a&b",...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_slice.py
tests/template_tests/filter_tests/test_slice.py
from django.template.defaultfilters import slice_filter from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class SliceTests(SimpleTestCase): @setup({"slice01": '{{ a|slice:"1:3" }} {{ b|slice:"1:3" }}'}) def test_slice01(self): output = self...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_truncatewords.py
tests/template_tests/filter_tests/test_truncatewords.py
from django.template.defaultfilters import truncatewords from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class TruncatewordsTests(SimpleTestCase): @setup( { "truncatewords01": ( '{% autoescape off %}{{ a|truncatewo...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_truncatechars_html.py
tests/template_tests/filter_tests/test_truncatechars_html.py
from django.template.defaultfilters import truncatechars_html from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_truncate_zero(self): self.assertEqual( truncatechars_html( '<p>one <a href="#">two - three <br>four</a> five</p>', 0 ),...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_rjust.py
tests/template_tests/filter_tests/test_rjust.py
from django.template.defaultfilters import rjust from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class RjustTests(SimpleTestCase): @setup( { "rjust01": ( '{% autoescape off %}.{{ a|rjust:"5" }}. .{{ b|rjust:"5" }}....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_center.py
tests/template_tests/filter_tests/test_center.py
from django.template.defaultfilters import center from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class CenterTests(SimpleTestCase): @setup( { "center01": ( '{% autoescape off %}.{{ a|center:"5" }}. .{{ b|center:"5...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_filesizeformat.py
tests/template_tests/filter_tests/test_filesizeformat.py
from django.template.defaultfilters import filesizeformat from django.test import SimpleTestCase from django.utils import translation class FunctionTests(SimpleTestCase): def test_formats(self): tests = [ (0, "0\xa0bytes"), (1, "1\xa0byte"), (1023, "1023\xa0bytes"), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_lower.py
tests/template_tests/filter_tests/test_lower.py
from django.template.defaultfilters import lower from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LowerTests(SimpleTestCase): @setup( { "lower01": ( "{% autoescape off %}{{ a|lower }} {{ b|lower }}{% endautoes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_length.py
tests/template_tests/filter_tests/test_length.py
from django.template.defaultfilters import length from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LengthTests(SimpleTestCase): @setup({"length01": "{{ list|length }}"}) def test_length01(self): output = self.engine.render_to_string(...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_last.py
tests/template_tests/filter_tests/test_last.py
from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LastTests(SimpleTestCase): @setup({"last01": "{{ a|last }} {{ b|last }}"}) def test_last01(self): output = self.engine.render_to_string( "last01", {"a": ["x", "a&b"], "b": ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_cut.py
tests/template_tests/filter_tests/test_cut.py
from django.template.defaultfilters import cut from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class CutTests(SimpleTestCase): @setup( { "cut01": ( '{% autoescape off %}{{ a|cut:"x" }} {{ b|cut:"x" }}{% endautoesca...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_chaining.py
tests/template_tests/filter_tests/test_chaining.py
from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class ChainingTests(SimpleTestCase): """ Chaining safeness-preserving filters should not alter the safe status. """ @setup({"chaining01": '{{ a|capfirst|center:"7" }}.{{ b|capfirst|center:"...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_wordwrap.py
tests/template_tests/filter_tests/test_wordwrap.py
from django.template.defaultfilters import wordwrap from django.test import SimpleTestCase from django.utils.functional import lazystr from django.utils.safestring import mark_safe from ..utils import setup class WordwrapTests(SimpleTestCase): @setup( { "wordwrap01": ( '{% aut...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_linenumbers.py
tests/template_tests/filter_tests/test_linenumbers.py
from django.template.defaultfilters import linenumbers from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LinenumbersTests(SimpleTestCase): """ The contents of "linenumbers" is escaped according to the current autoescape setting. """ ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_phone2numeric.py
tests/template_tests/filter_tests/test_phone2numeric.py
from django.template.defaultfilters import phone2numeric_filter from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class Phone2numericTests(SimpleTestCase): @setup({"phone2numeric01": "{{ a|phone2numeric }} {{ b|phone2numeric }}"}) def test_phone2nu...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_capfirst.py
tests/template_tests/filter_tests/test_capfirst.py
from django.template.defaultfilters import capfirst from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class CapfirstTests(SimpleTestCase): @setup( { "capfirst01": ( "{% autoescape off %}{{ a|capfirst }} {{ b|capfirst...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_ljust.py
tests/template_tests/filter_tests/test_ljust.py
from django.template.defaultfilters import ljust from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LjustTests(SimpleTestCase): @setup( { "ljust01": ( '{% autoescape off %}.{{ a|ljust:"5" }}. .{{ b|ljust:"5" }}....
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_truncatewords_html.py
tests/template_tests/filter_tests/test_truncatewords_html.py
from django.template.defaultfilters import truncatewords_html from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_truncate_zero(self): self.assertEqual( truncatewords_html( '<p>one <a href="#">two - three <br>four</a> five</p>', 0 ),...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_escapeseq.py
tests/template_tests/filter_tests/test_escapeseq.py
from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class EscapeseqTests(SimpleTestCase): """ The "escapeseq" filter works the same whether autoescape is on or off, and has no effect on strings already marked as safe. """ @setup( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_stringformat.py
tests/template_tests/filter_tests/test_stringformat.py
from django.template.defaultfilters import stringformat from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class StringformatTests(SimpleTestCase): """ Notice that escaping is applied *after* any filters, so the string formatting here only needs...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_addslashes.py
tests/template_tests/filter_tests/test_addslashes.py
from django.template.defaultfilters import addslashes from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class AddslashesTests(SimpleTestCase): @setup( { "addslashes01": ( "{% autoescape off %}{{ a|addslashes }} {{ b|...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_safeseq.py
tests/template_tests/filter_tests/test_safeseq.py
from django.test import SimpleTestCase from ..utils import setup class SafeseqTests(SimpleTestCase): @setup({"safeseq01": '{{ a|join:", " }} -- {{ a|safeseq|join:", " }}'}) def test_safeseq01(self): output = self.engine.render_to_string("safeseq01", {"a": ["&", "<"]}) self.assertEqual(output,...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_timeuntil.py
tests/template_tests/filter_tests/test_timeuntil.py
from datetime import datetime, timedelta from django.template.defaultfilters import timeuntil_filter from django.test import SimpleTestCase from django.test.utils import requires_tz_support from ..utils import setup from .timezone_utils import TimezoneTestCase class TimeuntilTests(TimezoneTestCase): # Default c...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_escape.py
tests/template_tests/filter_tests/test_escape.py
from django.template.defaultfilters import escape from django.test import SimpleTestCase from django.utils.functional import Promise, lazy from django.utils.safestring import mark_safe from ..utils import setup class EscapeTests(SimpleTestCase): """ The "escape" filter works the same whether autoescape is on...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_timesince.py
tests/template_tests/filter_tests/test_timesince.py
from datetime import datetime, timedelta from django.template.defaultfilters import timesince_filter from django.test import SimpleTestCase from django.test.utils import requires_tz_support from ..utils import setup from .timezone_utils import TimezoneTestCase class TimesinceTests(TimezoneTestCase): """ #20...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_floatformat.py
tests/template_tests/filter_tests/test_floatformat.py
from decimal import Decimal, localcontext from django.template.defaultfilters import floatformat from django.test import SimpleTestCase from django.utils import translation from django.utils.safestring import mark_safe from django.utils.version import PYPY from ..utils import setup class FloatformatTests(SimpleTest...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_urlizetrunc.py
tests/template_tests/filter_tests/test_urlizetrunc.py
from django.template.defaultfilters import urlizetrunc from django.test import SimpleTestCase from django.test.utils import override_settings from django.utils.safestring import mark_safe from ..utils import setup class UrlizetruncTests(SimpleTestCase): @setup( { "urlizetrunc01": ( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_date.py
tests/template_tests/filter_tests/test_date.py
from datetime import datetime, time from django.template.defaultfilters import date from django.test import SimpleTestCase from django.utils import timezone, translation from ..utils import setup from .timezone_utils import TimezoneTestCase class DateTests(TimezoneTestCase): @setup({"date01": '{{ d|date:"m" }}'...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_autoescape.py
tests/template_tests/filter_tests/test_autoescape.py
from django.test import SimpleTestCase from ..utils import SafeClass, UnsafeClass, setup class AutoescapeStringfilterTests(SimpleTestCase): """ Filters decorated with stringfilter still respect is_safe. """ @setup({"autoescape-stringfilter01": "{{ unsafe|capfirst }}"}) def test_autoescape_string...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_default.py
tests/template_tests/filter_tests/test_default.py
from django.template.defaultfilters import default from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class DefaultTests(SimpleTestCase): """ Literal string arguments to the default filter are always treated as safe strings, regardless of the au...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/__init__.py
tests/template_tests/filter_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_dictsortreversed.py
tests/template_tests/filter_tests/test_dictsortreversed.py
from django.template.defaultfilters import dictsortreversed from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_sort(self): sorted_dicts = dictsortreversed( [ {"age": 23, "name": "Barbara-Ann"}, {"age": 63, "name": "Ra Ra Rasputi...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_dictsort.py
tests/template_tests/filter_tests/test_dictsort.py
from django.template.defaultfilters import _property_resolver, dictsort from django.test import SimpleTestCase class User: password = "abc" _private = "private" @property def test_property(self): return "cde" def test_method(self): """This is just a test method.""" class Funct...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_pluralize.py
tests/template_tests/filter_tests/test_pluralize.py
from decimal import Decimal from django.template.defaultfilters import pluralize from django.test import SimpleTestCase from ..utils import setup class PluralizeTests(SimpleTestCase): def check_values(self, *tests): for value, expected in tests: with self.subTest(value=value): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/timezone_utils.py
tests/template_tests/filter_tests/timezone_utils.py
from datetime import date, datetime from django.test import SimpleTestCase from django.utils import timezone class TimezoneTestCase(SimpleTestCase): def setUp(self): self.now = datetime.now() self.now_tz = timezone.make_aware( self.now, timezone.get_default_timezone(), ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_urlencode.py
tests/template_tests/filter_tests/test_urlencode.py
from django.template.defaultfilters import urlencode from django.test import SimpleTestCase from ..utils import setup class UrlencodeTests(SimpleTestCase): @setup({"urlencode01": "{{ url|urlencode }}"}) def test_urlencode01(self): output = self.engine.render_to_string("urlencode01", {"url": '/test&"/...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_safe.py
tests/template_tests/filter_tests/test_safe.py
from django.test import SimpleTestCase from ..utils import setup class SafeTests(SimpleTestCase): @setup({"safe01": "{{ a }} -- {{ a|safe }}"}) def test_safe01(self): output = self.engine.render_to_string("safe01", {"a": "<b>hello</b>"}) self.assertEqual(output, "&lt;b&gt;hello&lt;/b&gt; -- <...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_truncatechars.py
tests/template_tests/filter_tests/test_truncatechars.py
from django.test import SimpleTestCase from ..utils import setup class TruncatecharsTests(SimpleTestCase): @setup({"truncatechars01": "{{ a|truncatechars:3 }}"}) def test_truncatechars01(self): output = self.engine.render_to_string( "truncatechars01", {"a": "Testing, testing"} ) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_linebreaksbr.py
tests/template_tests/filter_tests/test_linebreaksbr.py
from django.template.defaultfilters import linebreaksbr from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class LinebreaksbrTests(SimpleTestCase): """ The contents in "linebreaksbr" are escaped according to the current autoescape setting. "...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_striptags.py
tests/template_tests/filter_tests/test_striptags.py
from django.template.defaultfilters import striptags from django.test import SimpleTestCase from django.utils.functional import lazystr from django.utils.safestring import mark_safe from ..utils import setup class StriptagsTests(SimpleTestCase): @setup({"striptags01": "{{ a|striptags }} {{ b|striptags }}"}) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_make_list.py
tests/template_tests/filter_tests/test_make_list.py
from django.template.defaultfilters import make_list from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class MakeListTests(SimpleTestCase): """ The make_list filter can destroy existing escaping, so the results are escaped. """ @setup(...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_wordcount.py
tests/template_tests/filter_tests/test_wordcount.py
from django.template.defaultfilters import wordcount from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class WordcountTests(SimpleTestCase): @setup( { "wordcount01": ( "{% autoescape off %}{{ a|wordcount }} {{ b|word...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_default_if_none.py
tests/template_tests/filter_tests/test_default_if_none.py
from django.template.defaultfilters import default_if_none from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_value(self): self.assertEqual(default_if_none("val", "default"), "val") def test_none(self): self.assertEqual(default_if_none(None, "default"), "defa...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_json_script.py
tests/template_tests/filter_tests/test_json_script.py
from django.test import SimpleTestCase from ..utils import setup class JsonScriptTests(SimpleTestCase): @setup({"json-tag01": '{{ value|json_script:"test_id" }}'}) def test_basic(self): output = self.engine.render_to_string( "json-tag01", {"value": {"a": "testing\r\njson 'string\" <b>esca...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_get_digit.py
tests/template_tests/filter_tests/test_get_digit.py
from django.template.defaultfilters import get_digit from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_values(self): self.assertEqual(get_digit(123, 1), 3) self.assertEqual(get_digit(123, 2), 2) self.assertEqual(get_digit(123, 3), 1) self.assertEq...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_title.py
tests/template_tests/filter_tests/test_title.py
from django.template.defaultfilters import title from django.test import SimpleTestCase from ..utils import setup class TitleTests(SimpleTestCase): @setup({"title1": "{{ a|title }}"}) def test_title1(self): output = self.engine.render_to_string("title1", {"a": "JOE'S CRAB SHACK"}) self.assert...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/filter_tests/test_slugify.py
tests/template_tests/filter_tests/test_slugify.py
from django.template.defaultfilters import slugify from django.test import SimpleTestCase from django.utils.functional import lazy from django.utils.safestring import mark_safe from ..utils import setup class SlugifyTests(SimpleTestCase): """ Running slugify on a pre-escaped string leads to odd behavior, ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_now.py
tests/template_tests/syntax_tests/test_now.py
from datetime import datetime from django.template import TemplateSyntaxError from django.test import SimpleTestCase from django.utils.formats import date_format from ..utils import setup class NowTagTests(SimpleTestCase): @setup({"now01": '{% now "j n Y" %}'}) def test_now01(self): """ Simp...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_named_endblock.py
tests/template_tests/syntax_tests/test_named_endblock.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class NamedEndblockTests(SimpleTestCase): @setup( { "namedendblocks01": "1{% block first %}_{% block second %}" "2{% endblock second %}_{% endblock first %}3" }...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_invalid_string.py
tests/template_tests/syntax_tests/test_invalid_string.py
from django.test import SimpleTestCase from ..utils import setup class InvalidStringTests(SimpleTestCase): libraries = {"i18n": "django.templatetags.i18n"} @setup({"invalidstr01": '{{ var|default:"Foo" }}'}) def test_invalidstr01(self): output = self.engine.render_to_string("invalidstr01") ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_multiline.py
tests/template_tests/syntax_tests/test_multiline.py
from django.test import SimpleTestCase from ..utils import setup multiline_string = """ Hello, boys. How are you gentlemen. """ class MultilineTests(SimpleTestCase): @setup({"multiline01": multiline_string}) def test_multiline01(self): output = self.engine.render_to_string("multiline01") sel...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_load.py
tests/template_tests/syntax_tests/test_load.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class LoadTagTests(SimpleTestCase): libraries = { "subpackage.echo": "template_tests.templatetags.subpackage.echo", "testtags": "template_tests.templatetags.testtags", } @setu...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_lorem.py
tests/template_tests/syntax_tests/test_lorem.py
from django.template.base import TemplateSyntaxError from django.test import SimpleTestCase from django.utils.lorem_ipsum import COMMON_P, WORDS from ..utils import setup class LoremTagTests(SimpleTestCase): @setup({"lorem1": "{% lorem 3 w %}"}) def test_lorem1(self): output = self.engine.render_to_s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_verbatim.py
tests/template_tests/syntax_tests/test_verbatim.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class VerbatimTagTests(SimpleTestCase): @setup({"verbatim-tag01": "{% verbatim %}{{bare }}{% endverbatim %}"}) def test_verbatim_tag01(self): output = self.engine.render_to_string("verba...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_width_ratio.py
tests/template_tests/syntax_tests/test_width_ratio.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class WidthRatioTagTests(SimpleTestCase): libraries = {"custom": "template_tests.templatetags.custom"} @setup({"widthratio01": "{% widthratio a b 0 %}"}) def test_widthratio01(self): ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_include.py
tests/template_tests/syntax_tests/test_include.py
from django.template import ( Context, Engine, TemplateDoesNotExist, TemplateSyntaxError, loader, ) from django.template.loader_tags import IncludeNode from django.test import SimpleTestCase from ..utils import setup from .test_basic import basic_templates include_fail_templates = { "include-f...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_list_index.py
tests/template_tests/syntax_tests/test_list_index.py
from django.test import SimpleTestCase from ..utils import setup class ListIndexTests(SimpleTestCase): @setup({"list-index01": "{{ var.1 }}"}) def test_list_index01(self): """ List-index syntax allows a template to access a certain item of a subscriptable object. """ o...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_extends.py
tests/template_tests/syntax_tests/test_extends.py
from django.template import NodeList, TemplateSyntaxError from django.template.base import Node from django.template.loader_tags import ExtendsNode from django.test import SimpleTestCase from ..utils import setup inheritance_templates = { "inheritance01": ( "1{% block first %}&{% endblock %}3{% block seco...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_regroup.py
tests/template_tests/syntax_tests/test_regroup.py
from datetime import date from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class RegroupTagTests(SimpleTestCase): @setup( { "regroup01": "" "{% regroup data by bar as grouped %}" "{% for group in grouped ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_if_changed.py
tests/template_tests/syntax_tests/test_if_changed.py
from django.template import Context, Engine from django.test import SimpleTestCase from ..utils import setup class IfChangedTagTests(SimpleTestCase): libraries = {"custom": "template_tests.templatetags.custom"} @setup( { "ifchanged01": ( "{% for n in num %}{% ifchanged %}...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_if.py
tests/template_tests/syntax_tests/test_if.py
from django.template import TemplateSyntaxError from django.template.defaulttags import IfNode from django.test import SimpleTestCase from ..utils import TestObj, setup class IfTagTests(SimpleTestCase): @setup({"if-tag01": "{% if foo %}yes{% else %}no{% endif %}"}) def test_if_tag01(self): output = s...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_cache.py
tests/template_tests/syntax_tests/test_cache.py
from django.core.cache import cache from django.template import Context, Engine, TemplateSyntaxError from django.test import SimpleTestCase, override_settings from ..utils import setup class CacheTagTests(SimpleTestCase): libraries = { "cache": "django.templatetags.cache", "custom": "template_tes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_cycle.py
tests/template_tests/syntax_tests/test_cycle.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class CycleTagTests(SimpleTestCase): @setup({"cycle01": "{% cycle a %}"}) def test_cycle01(self): msg = "No named cycles in template. 'a' is not defined" with self.assertRaisesMess...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_filter_tag.py
tests/template_tests/syntax_tests/test_filter_tag.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class FilterTagTests(SimpleTestCase): @setup({"filter01": "{% filter upper %}{% endfilter %}"}) def test_filter01(self): output = self.engine.render_to_string("filter01") self.asse...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_filter_syntax.py
tests/template_tests/syntax_tests/test_filter_syntax.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import SomeClass, SomeOtherException, UTF8Class, setup class FilterSyntaxTests(SimpleTestCase): @setup({"filter-syntax01": "{{ var|upper }}"}) def test_filter_syntax01(self): """ Basic filter u...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_url.py
tests/template_tests/syntax_tests/test_url.py
from django.template import RequestContext, TemplateSyntaxError from django.template.defaulttags import URLNode from django.test import RequestFactory, SimpleTestCase, override_settings from django.urls import NoReverseMatch, resolve from ..utils import setup @override_settings(ROOT_URLCONF="template_tests.urls") cl...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_builtins.py
tests/template_tests/syntax_tests/test_builtins.py
from django.test import SimpleTestCase from ..utils import setup class BuiltinsTests(SimpleTestCase): @setup({"builtins01": "{{ True }}"}) def test_builtins01(self): output = self.engine.render_to_string("builtins01") self.assertEqual(output, "True") @setup({"builtins02": "{{ False }}"})...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_numpy.py
tests/template_tests/syntax_tests/test_numpy.py
from unittest import skipIf from django.test import SimpleTestCase from ..utils import setup try: import numpy except ImportError: numpy = False @skipIf(numpy is False, "Numpy must be installed to run these tests.") class NumpyTests(SimpleTestCase): @setup({"numpy-array-index01": "{{ var.1 }}"}) de...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_comment.py
tests/template_tests/syntax_tests/test_comment.py
from django.test import SimpleTestCase from ..utils import setup class CommentSyntaxTests(SimpleTestCase): @setup({"comment-syntax01": "{# this is hidden #}hello"}) def test_comment_syntax01(self): output = self.engine.render_to_string("comment-syntax01") self.assertEqual(output, "hello") ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_autoescape.py
tests/template_tests/syntax_tests/test_autoescape.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import SafeClass, UnsafeClass, setup class AutoescapeTagTests(SimpleTestCase): @setup({"autoescape-tag01": "{% autoescape off %}hello{% endautoescape %}"}) def tes...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_static.py
tests/template_tests/syntax_tests/test_static.py
from urllib.parse import urljoin from django.conf import settings from django.template import TemplateSyntaxError from django.templatetags.static import StaticNode from django.test import SimpleTestCase, override_settings from ..utils import setup @override_settings(INSTALLED_APPS=[], MEDIA_URL="media/", STATIC_URL...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_setup.py
tests/template_tests/syntax_tests/test_setup.py
from django.test import SimpleTestCase from ..utils import setup class SetupTests(SimpleTestCase): def test_setup(self): """ Let's just make sure setup runs cases in the right order. """ cases = [] @setup({}) def method(self): cases.append( ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/test_firstof.py
tests/template_tests/syntax_tests/test_firstof.py
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class FirstOfTagTests(SimpleTestCase): @setup({"firstof01": "{% firstof a b c %}"}) def test_firstof01(self): output = self.engine.render_to_string("firstof01", {"a": 0, "c": 0, "b": 0}) ...
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false
django/django
https://github.com/django/django/blob/3201a895cba335000827b28768a7b7105c81b415/tests/template_tests/syntax_tests/__init__.py
tests/template_tests/syntax_tests/__init__.py
python
BSD-3-Clause
3201a895cba335000827b28768a7b7105c81b415
2026-01-04T14:38:15.489092Z
false