summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2018-09-28 18:57:12 +0500
committerTim Graham <timograham@gmail.com>2018-09-28 09:57:12 -0400
commit8ef8bc0f64c463684268a7c55f3d3da4de066c0d (patch)
tree9c3ab782c6382bdbc91363d0dd5513df83381903 /tests/template_tests
parent4fc8fb7ddaad495d45d53df58b2d13115857b3c7 (diff)
Refs #28909 -- Simplifed code using unpacking generalizations.
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/templatetags/custom.py4
-rw-r--r--tests/template_tests/templatetags/inclusion.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py
index 45acd9655e..eaaff193ee 100644
--- a/tests/template_tests/templatetags/custom.py
+++ b/tests/template_tests/templatetags/custom.py
@@ -111,7 +111,7 @@ simple_one_default.anything = "Expected simple_one_default __dict__"
def simple_unlimited_args(one, two='hi', *args):
"""Expected simple_unlimited_args __doc__"""
return "simple_unlimited_args - Expected result: %s" % (
- ', '.join(str(arg) for arg in [one, two] + list(args))
+ ', '.join(str(arg) for arg in [one, two, *args])
)
@@ -133,7 +133,7 @@ def simple_unlimited_args_kwargs(one, two='hi', *args, **kwargs):
# 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] + list(args)),
+ ', '.join(str(arg) for arg in [one, two, *args]),
', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg)
)
diff --git a/tests/template_tests/templatetags/inclusion.py b/tests/template_tests/templatetags/inclusion.py
index 60f654ec00..242fbe80cb 100644
--- a/tests/template_tests/templatetags/inclusion.py
+++ b/tests/template_tests/templatetags/inclusion.py
@@ -151,7 +151,7 @@ def inclusion_unlimited_args(one, two='hi', *args):
return {
"result": (
"inclusion_unlimited_args - Expected result: %s" % (
- ', '.join(str(arg) for arg in [one, two] + list(args))
+ ', '.join(str(arg) for arg in [one, two, *args])
)
)
}
@@ -166,7 +166,7 @@ def inclusion_unlimited_args_from_template(one, two='hi', *args):
return {
"result": (
"inclusion_unlimited_args_from_template - Expected result: %s" % (
- ', '.join(str(arg) for arg in [one, two] + list(args))
+ ', '.join(str(arg) for arg in [one, two, *args])
)
)
}
@@ -216,7 +216,7 @@ def inclusion_unlimited_args_kwargs(one, two='hi', *args, **kwargs):
# 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] + list(args)),
+ ', '.join(str(arg) for arg in [one, two, *args]),
', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg)
)}