summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-05-08 21:49:54 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-05-08 22:45:26 +0200
commite244e456c7e5b9ba87c32fcf2c7363170982ab9c (patch)
tree24b4660394b5d07c62041cf820f81e68c315c237 /tests/schema
parent189bcb9b094ab4c9f328488e9ae6f9e85ba0b229 (diff)
[1.7.x] Appeased flake8.
Backport of b1432bfc from master
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 371eaadecb..b0dd9ada90 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -236,14 +236,18 @@ class SchemaTests(TransactionTestCase):
Tests adding fields to models with a default that is not directly
valid in the database (#22581)
"""
+
class TestTransformField(IntegerField):
+
# Weird field that saves the count of items in its value
def get_default(self):
return self.default
+
def get_prep_value(self, value):
if value is None:
return 0
return len(value)
+
# Create the table
with connection.schema_editor() as editor:
editor.create_model(Author)
@@ -251,7 +255,7 @@ class SchemaTests(TransactionTestCase):
Author.objects.create(name="Andrew", height=30)
Author.objects.create(name="Andrea")
# Add the field with a default it needs to cast (to string in this case)
- new_field = TestTransformField(default={1:2})
+ new_field = TestTransformField(default={1: 2})
new_field.set_attributes_from_name("thing")
with connection.schema_editor() as editor:
editor.add_field(