summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authormriduldhall <mriduldhall1@gmail.com>2025-07-25 16:27:20 +0100
committernessita <124304+nessita@users.noreply.github.com>2025-07-28 16:41:06 -0300
commitd4dd3e503c88db92f254769a64b2fcd4c572c7dc (patch)
treec2808b0a4c7692a90adf6cd30a9356d31f55409d /tests/template_tests
parent2d4ca621700eed97f0cb8a19d02a05fc088b26d2 (diff)
Fixed #36519 -- Made center template filter consistent for even/odd padding.
Refactored `center` template filter to match f-string behaviour, producing consistent padding for both odd and even fillings. Thanks Lily Acorn for the report and Natalia Bidart for the review. Co-authored-by: Lily Acorn <code@lilyf.org>
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/filter_tests/test_center.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/template_tests/filter_tests/test_center.py b/tests/template_tests/filter_tests/test_center.py
index 8d0bf38006..dbbde4f300 100644
--- a/tests/template_tests/filter_tests/test_center.py
+++ b/tests/template_tests/filter_tests/test_center.py
@@ -35,6 +35,12 @@ class FunctionTests(SimpleTestCase):
def test_non_string_input(self):
self.assertEqual(center(123, 5), " 123 ")
+ def test_odd_input(self):
+ self.assertEqual(center("odd", 6), " odd ")
+
+ def test_even_input(self):
+ self.assertEqual(center("even", 7), " even ")
+
def test_widths(self):
value = "something"
for i in range(-1, len(value) + 1):