mirror of
https://github.com/django/django.git
synced 2025-11-24 21:00:12 +00:00
Fixed #36383 -- Improved migration serialization for functools.partial objects.
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
Some checks are pending
Docs / docs (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run
This commit is contained in:
parent
57fdc104d2
commit
6e36f7f784
2 changed files with 11 additions and 23 deletions
|
|
@ -911,7 +911,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partial(datetime.timedelta, *(), **{})",
|
||||
"functools.partial(datetime.timedelta)",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
|
||||
|
|
@ -920,7 +920,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partial(datetime.timedelta, *(1,), **{})",
|
||||
"functools.partial(datetime.timedelta, 1)",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
|
||||
|
|
@ -929,7 +929,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partial(datetime.timedelta, *(), **{'seconds': 2})",
|
||||
"functools.partial(datetime.timedelta, seconds=2)",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
|
||||
|
|
@ -938,7 +938,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partial(datetime.timedelta, *(1,), **{'seconds': 2})",
|
||||
"functools.partial(datetime.timedelta, 1, seconds=2)",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
|
||||
|
|
@ -947,7 +947,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partial(datetime.timedelta, *(), **{'kebab-case': 1})",
|
||||
"functools.partial(datetime.timedelta, **{'kebab-case': 1})",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
|
||||
|
|
@ -956,7 +956,7 @@ class WriterTests(SimpleTestCase):
|
|||
string, imports = MigrationWriter.serialize(value)
|
||||
result = self.assertSerializedFunctoolsPartialEqual(
|
||||
value,
|
||||
"functools.partialmethod(datetime.timedelta, *(1,), **{'seconds': 2})",
|
||||
"functools.partialmethod(datetime.timedelta, 1, seconds=2)",
|
||||
{"import datetime", "import functools"},
|
||||
)
|
||||
self.assertIsInstance(result, functools.partialmethod)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue