diff options
| author | ElizabethU <elizabeth.uselton@gmail.com> | 2019-09-02 19:09:31 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-10-01 17:58:19 +0200 |
| commit | 54ea290e5bbd19d87bd8dba807738eeeaf01a362 (patch) | |
| tree | d83c186bde9f50faa13840e6ee227e3bb1e02ad6 /tests/expressions | |
| parent | 6475e6318c970359a2f02798910a917229ee17d7 (diff) | |
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.
Diffstat (limited to 'tests/expressions')
| -rw-r--r-- | tests/expressions/tests.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index f50c634014..094b738792 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -3,6 +3,7 @@ import pickle import unittest import uuid from copy import deepcopy +from unittest import mock from django.core.exceptions import FieldError from django.db import DatabaseError, connection, models @@ -965,6 +966,7 @@ class SimpleExpressionTests(SimpleTestCase): Expression(models.IntegerField()), Expression(output_field=models.IntegerField()) ) + self.assertEqual(Expression(models.IntegerField()), mock.ANY) self.assertNotEqual( Expression(models.IntegerField()), Expression(models.CharField()) |
