mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #35175 -- Made migraton writer preserve keyword-only arguments.
Thanks Gerald Goh for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
8b7ddd1b62
commit
06264258dc
@@ -152,6 +152,24 @@ class OperationWriterTests(SimpleTestCase):
|
||||
"),",
|
||||
)
|
||||
|
||||
def test_keyword_only_args_signature(self):
|
||||
operation = (
|
||||
custom_migration_operations.operations.ArgsAndKeywordOnlyArgsOperation(
|
||||
1, 2, kwarg1=3, kwarg2=4
|
||||
)
|
||||
)
|
||||
buff, imports = OperationWriter(operation, indentation=0).serialize()
|
||||
self.assertEqual(imports, {"import custom_migration_operations.operations"})
|
||||
self.assertEqual(
|
||||
buff,
|
||||
"custom_migration_operations.operations.ArgsAndKeywordOnlyArgsOperation(\n"
|
||||
" arg1=1,\n"
|
||||
" arg2=2,\n"
|
||||
" kwarg1=3,\n"
|
||||
" kwarg2=4,\n"
|
||||
"),",
|
||||
)
|
||||
|
||||
def test_nested_args_signature(self):
|
||||
operation = custom_migration_operations.operations.ArgsOperation(
|
||||
custom_migration_operations.operations.ArgsOperation(1, 2),
|
||||
|
||||
Reference in New Issue
Block a user