summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-07-12 11:06:59 +0200
committerGitHub <noreply@github.com>2023-07-12 11:06:59 +0200
commit4afaeb14c293725d7b2530788083fce1c120ff65 (patch)
tree243c3b3e322414a11b3919adebd44f1ca9925f81 /tests/template_tests
parent503ce7f1b791fd23d1fccc1970ba83ec55532a1c (diff)
Refs #30116 -- Simplified tests related with dictionary order.
Dicts preserve order since Python 3.6.
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/templatetags/custom.py6
-rw-r--r--tests/template_tests/templatetags/inclusion.py6
2 files changed, 2 insertions, 10 deletions
diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py
index f096e98286..0937085c8c 100644
--- a/tests/template_tests/templatetags/custom.py
+++ b/tests/template_tests/templatetags/custom.py
@@ -1,5 +1,3 @@
-import operator
-
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import escape, format_html
@@ -138,11 +136,9 @@ simple_only_unlimited_args.anything = "Expected simple_only_unlimited_args __dic
@register.simple_tag
def simple_unlimited_args_kwargs(one, two="hi", *args, **kwargs):
"""Expected simple_unlimited_args_kwargs __doc__"""
- # Sort the dictionary by key to guarantee the order for testing.
- sorted_kwarg = sorted(kwargs.items(), key=operator.itemgetter(0))
return "simple_unlimited_args_kwargs - Expected result: %s / %s" % (
", ".join(str(arg) for arg in [one, two, *args]),
- ", ".join("%s=%s" % (k, v) for (k, v) in sorted_kwarg),
+ ", ".join("%s=%s" % (k, v) for (k, v) in kwargs.items()),
)
diff --git a/tests/template_tests/templatetags/inclusion.py b/tests/template_tests/templatetags/inclusion.py
index c4455e4fa4..ea749a43b5 100644
--- a/tests/template_tests/templatetags/inclusion.py
+++ b/tests/template_tests/templatetags/inclusion.py
@@ -1,5 +1,3 @@
-import operator
-
from django.template import Engine, Library
engine = Engine(app_dirs=True)
@@ -257,13 +255,11 @@ inclusion_tag_use_l10n.anything = "Expected inclusion_tag_use_l10n __dict__"
@register.inclusion_tag("inclusion.html")
def inclusion_unlimited_args_kwargs(one, two="hi", *args, **kwargs):
"""Expected inclusion_unlimited_args_kwargs __doc__"""
- # Sort the dictionary by key to guarantee the order for testing.
- sorted_kwarg = sorted(kwargs.items(), key=operator.itemgetter(0))
return {
"result": "inclusion_unlimited_args_kwargs - Expected result: %s / %s"
% (
", ".join(str(arg) for arg in [one, two, *args]),
- ", ".join("%s=%s" % (k, v) for (k, v) in sorted_kwarg),
+ ", ".join("%s=%s" % (k, v) for (k, v) in kwargs.items()),
)
}