summaryrefslogtreecommitdiff
path: root/tests/template_tests
diff options
context:
space:
mode:
authorGeorge Y. Kussumoto <georgeyk.dev@gmail.com>2024-06-04 15:07:01 -0300
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-06-13 14:22:40 +0200
commit2a32b233822683c51e59722b7c9aa0789fc4ab1b (patch)
treefe05cbfb38f376409b059a74bb3906ee7940aa0c /tests/template_tests
parent8733e9af998f0009d62e4f0f3d5ee566e93a4893 (diff)
Fixed #35417 -- Updated BaseContext.new() with values to create a context that can be flattened.
Diffstat (limited to 'tests/template_tests')
-rw-r--r--tests/template_tests/test_context.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py
index 7420bb4c36..6d8ee7a6e6 100644
--- a/tests/template_tests/test_context.py
+++ b/tests/template_tests/test_context.py
@@ -158,6 +158,17 @@ class ContextTests(SimpleTestCase):
},
)
+ def test_flatten_context_with_context_copy(self):
+ ctx1 = Context({"a": 2})
+ ctx2 = ctx1.new(Context({"b": 4}))
+ self.assertEqual(
+ ctx2.dicts, [{"True": True, "False": False, "None": None}, {"b": 4}]
+ )
+ self.assertEqual(
+ ctx2.flatten(),
+ {"False": False, "None": None, "True": True, "b": 4},
+ )
+
def test_context_comparable(self):
"""
#21765 -- equality comparison should work