From 54ea290e5bbd19d87bd8dba807738eeeaf01a362 Mon Sep 17 00:00:00 2001 From: ElizabethU Date: Mon, 2 Sep 2019 19:09:31 -0700 Subject: Fixed #30651 -- Made __eq__() methods return NotImplemented for not implemented comparisons. Changed __eq__ to return NotImplemented instead of False if compared to an object of the same type, as is recommended by the Python data model reference. Now these models can be compared to ANY (or other objects with __eq__ overwritten) without returning False automatically. --- tests/template_tests/test_context.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/template_tests/test_context.py') diff --git a/tests/template_tests/test_context.py b/tests/template_tests/test_context.py index 8c6fc98b42..1150a14639 100644 --- a/tests/template_tests/test_context.py +++ b/tests/template_tests/test_context.py @@ -1,3 +1,5 @@ +from unittest import mock + from django.http import HttpRequest from django.template import ( Context, Engine, RequestContext, Template, Variable, VariableDoesNotExist, @@ -18,6 +20,7 @@ class ContextTests(SimpleTestCase): self.assertEqual(c.pop(), {"a": 2}) self.assertEqual(c["a"], 1) self.assertEqual(c.get("foo", 42), 42) + self.assertEqual(c, mock.ANY) def test_push_context_manager(self): c = Context({"a": 1}) -- cgit v1.3