mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Fixed #36173 -- Stabilized identity of Concat with an explicit output_field.
When Expression.__init__() overrides make use of *args, **kwargs captures their argument values are respectively bound as a tuple and dict instances. These composite values might themselves contain values that require special identity treatments such as Concat(output_field) as it's a Field instance. Refs #30628 which introduced bound Field differentiation but lacked argument captures handling. Thanks erchenstein for the report.
This commit is contained in:
parent
6fcd0440aa
commit
df2c4952df
3 changed files with 53 additions and 7 deletions
|
|
@ -107,3 +107,17 @@ class ConcatTests(TestCase):
|
|||
ctx.captured_queries[0]["sql"].count("::text"),
|
||||
1 if connection.vendor == "postgresql" else 0,
|
||||
)
|
||||
|
||||
def test_equal(self):
|
||||
self.assertEqual(
|
||||
Concat("foo", "bar", output_field=TextField()),
|
||||
Concat("foo", "bar", output_field=TextField()),
|
||||
)
|
||||
self.assertNotEqual(
|
||||
Concat("foo", "bar", output_field=TextField()),
|
||||
Concat("foo", "bar", output_field=CharField()),
|
||||
)
|
||||
self.assertNotEqual(
|
||||
Concat("foo", "bar", output_field=TextField()),
|
||||
Concat("bar", "foo", output_field=TextField()),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue