summaryrefslogtreecommitdiff
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 21:49:54 +0200
commitb1432bfc22bf0cac25c4b0c8d52456cb8b5804e8 (patch)
treee972481a81f8b44d3b74478e714ae769b5646b5e
parentfc32e9c0d92c51cedf7d686ce84ec52ed0d12a86 (diff)
downloaddjango-b1432bfc22bf0cac25c4b0c8d52456cb8b5804e8.tar.gz
Appeased flake8.
-rw-r--r--django/db/migrations/state.py6
-rw-r--r--tests/field_deconstruction/tests.py1
-rw-r--r--tests/migrations/test_operations.py3
-rw-r--r--tests/schema/tests.py6
4 files changed, 10 insertions, 6 deletions
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index 90e0b51b1e..32a0b69a44 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -89,9 +89,9 @@ class ProjectState(object):
# "ValueError: Lookup failed for model referenced by
# field migrations.Book.author: migrations.Author"
raise ValueError("Lookup failed for model referenced by field {field}: {model[0]}.{model[1]}{extra_message}".format(
- field = operations[0][1],
- model = lookup_model,
- extra_message = extra_message,
+ field=operations[0][1],
+ model=lookup_model,
+ extra_message=extra_message,
))
else:
do_pending_lookups(model)
diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py
index 0cf015ef06..0e75388747 100644
--- a/tests/field_deconstruction/tests.py
+++ b/tests/field_deconstruction/tests.py
@@ -3,7 +3,6 @@ import warnings
from django.db import models
from django.test import TestCase, override_settings
from django.utils import six
-from django.core.files.storage import FileSystemStorage
class FieldDeconstructionTests(TestCase):
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index 32319f373c..388544cb04 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -757,10 +757,12 @@ class OperationTests(MigrationTestBase):
Tests the RunPython operation correctly handles the "atomic" keyword
"""
project_state = self.set_up_test_model("test_runpythonatomic", mti_model=True)
+
def inner_method(models, schema_editor):
Pony = models.get_model("test_runpythonatomic", "Pony")
Pony.objects.create(pink=1, weight=3.55)
raise ValueError("Adrian hates ponies.")
+
atomic_migration = Migration("test", "test_runpythonatomic")
atomic_migration.operations = [migrations.RunPython(inner_method)]
non_atomic_migration = Migration("test", "test_runpythonatomic")
@@ -789,7 +791,6 @@ class OperationTests(MigrationTestBase):
self.assertEqual(project_state.render().get_model("test_runpythonatomic", "Pony").objects.count(), 1)
-
class MigrateNothingRouter(object):
"""
A router that sends all writes to the other database.
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(