summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/fields.py17
-rw-r--r--tests/schema/tests.py4
2 files changed, 11 insertions, 10 deletions
diff --git a/tests/schema/fields.py b/tests/schema/fields.py
index 16a61ee5f6..f03b9813b6 100644
--- a/tests/schema/fields.py
+++ b/tests/schema/fields.py
@@ -13,23 +13,24 @@ class CustomManyToManyField(RelatedField):
"""
many_to_many = True
- def __init__(self, to, db_constraint=True, swappable=True, **kwargs):
+ def __init__(self, to, db_constraint=True, swappable=True, related_name=None, related_query_name=None,
+ limit_choices_to=None, symmetrical=None, through=None, through_fields=None, db_table=None, **kwargs):
try:
to._meta
except AttributeError:
to = str(to)
kwargs['rel'] = ManyToManyRel(
self, to,
- related_name=kwargs.pop('related_name', None),
- related_query_name=kwargs.pop('related_query_name', None),
- limit_choices_to=kwargs.pop('limit_choices_to', None),
- symmetrical=kwargs.pop('symmetrical', to == RECURSIVE_RELATIONSHIP_CONSTANT),
- through=kwargs.pop('through', None),
- through_fields=kwargs.pop('through_fields', None),
+ related_name=related_name,
+ related_query_name=related_query_name,
+ limit_choices_to=limit_choices_to,
+ symmetrical=symmetrical if symmetrical is not None else (to == RECURSIVE_RELATIONSHIP_CONSTANT),
+ through=through,
+ through_fields=through_fields,
db_constraint=db_constraint,
)
self.swappable = swappable
- self.db_table = kwargs.pop('db_table', None)
+ self.db_table = db_table
if kwargs['rel'].through is not None:
assert self.db_table is None, "Cannot specify a db_table if an intermediary model is used."
super().__init__(**kwargs)
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index d21f608e02..abcaa5b480 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -1819,9 +1819,9 @@ class SchemaTests(TransactionTestCase):
"""
#23065 - Constraint names must be quoted if they contain capital letters.
"""
- def get_field(*args, **kwargs):
+ def get_field(*args, field_class=IntegerField, **kwargs):
kwargs['db_column'] = "CamelCase"
- field = kwargs.pop('field_class', IntegerField)(*args, **kwargs)
+ field = field_class(*args, **kwargs)
field.set_attributes_from_name("CamelCase")
return field