diff options
| author | Tim Richardson <tim@growtpath.com.au> | 2024-04-23 15:31:59 +1000 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-04-24 10:53:38 +0200 |
| commit | e64d42e753e5c7763398d018f5ccaa95efc7588e (patch) | |
| tree | 831e20cc0290d693c607f2d07dbcdbb79f525baf /tests/template_tests | |
| parent | 16d0542bb6812b94895136d26f86b33d20e6a072 (diff) | |
Fixed #35395 -- slice filter crashes on an empty dict with Python 3.12.
Keep consistent behaviour of slice() filter between python 3.12 and prior
versions in the case of a dict passed to the filter (catch the new to python
3.12 KeyError exception).
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/filter_tests/test_slice.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/template_tests/filter_tests/test_slice.py b/tests/template_tests/filter_tests/test_slice.py index 5a5dd6b155..23257b1282 100644 --- a/tests/template_tests/filter_tests/test_slice.py +++ b/tests/template_tests/filter_tests/test_slice.py @@ -53,3 +53,6 @@ class FunctionTests(SimpleTestCase): def test_fail_silently(self): obj = object() self.assertEqual(slice_filter(obj, "0::2"), obj) + + def test_empty_dict(self): + self.assertEqual(slice_filter({}, "1"), {}) |
