diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-11-17 16:07:23 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-11-18 16:05:37 +0100 |
| commit | 8d7b1423f89bcc3df57333fc79fa5aead17b0cbc (patch) | |
| tree | 17d8d8ed5b39749c70175358bb61806c926dda55 /tests/template_tests/test_context.py | |
| parent | e035db1bc3bbeb4282a177ad106add3b07d97b09 (diff) | |
Refs #35844 -- Fixed copying BaseContext and its subclasses on Python 3.14+.
super objects are copyable on Python 3.14+:
https://github.com/python/cpython/commit/5ca4e34bc1aab8321911aac6d5b2b9e75ff764d8
and can no longer be used in BaseContext.__copy__().
Diffstat (limited to 'tests/template_tests/test_context.py')
| -rw-r--r-- | tests/template_tests/test_context.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py index 6d8ee7a6e6..f71cf1ff25 100644 --- a/tests/template_tests/test_context.py +++ b/tests/template_tests/test_context.py @@ -1,3 +1,4 @@ +from copy import copy from unittest import mock from django.http import HttpRequest @@ -314,3 +315,10 @@ class RequestContextTests(SimpleTestCase): with self.assertRaisesMessage(TypeError, msg): with request_context.bind_template(Template("")): pass + + def test_context_copyable(self): + request_context = RequestContext(HttpRequest()) + request_context_copy = copy(request_context) + self.assertIsInstance(request_context_copy, RequestContext) + self.assertEqual(request_context_copy.dicts, request_context.dicts) + self.assertIsNot(request_context_copy.dicts, request_context.dicts) |
