mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
committed by
Mariusz Felisiak
parent
6fcd0440aa
commit
df2c4952df
@@ -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()),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user