Appeased flake8.
This commit is contained in:
parent
fc32e9c0d9
commit
b1432bfc22
|
@ -3,7 +3,6 @@ import warnings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.core.files.storage import FileSystemStorage
|
|
||||||
|
|
||||||
|
|
||||||
class FieldDeconstructionTests(TestCase):
|
class FieldDeconstructionTests(TestCase):
|
||||||
|
|
|
@ -757,10 +757,12 @@ class OperationTests(MigrationTestBase):
|
||||||
Tests the RunPython operation correctly handles the "atomic" keyword
|
Tests the RunPython operation correctly handles the "atomic" keyword
|
||||||
"""
|
"""
|
||||||
project_state = self.set_up_test_model("test_runpythonatomic", mti_model=True)
|
project_state = self.set_up_test_model("test_runpythonatomic", mti_model=True)
|
||||||
|
|
||||||
def inner_method(models, schema_editor):
|
def inner_method(models, schema_editor):
|
||||||
Pony = models.get_model("test_runpythonatomic", "Pony")
|
Pony = models.get_model("test_runpythonatomic", "Pony")
|
||||||
Pony.objects.create(pink=1, weight=3.55)
|
Pony.objects.create(pink=1, weight=3.55)
|
||||||
raise ValueError("Adrian hates ponies.")
|
raise ValueError("Adrian hates ponies.")
|
||||||
|
|
||||||
atomic_migration = Migration("test", "test_runpythonatomic")
|
atomic_migration = Migration("test", "test_runpythonatomic")
|
||||||
atomic_migration.operations = [migrations.RunPython(inner_method)]
|
atomic_migration.operations = [migrations.RunPython(inner_method)]
|
||||||
non_atomic_migration = Migration("test", "test_runpythonatomic")
|
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)
|
self.assertEqual(project_state.render().get_model("test_runpythonatomic", "Pony").objects.count(), 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MigrateNothingRouter(object):
|
class MigrateNothingRouter(object):
|
||||||
"""
|
"""
|
||||||
A router that sends all writes to the other database.
|
A router that sends all writes to the other database.
|
||||||
|
|
|
@ -236,14 +236,18 @@ class SchemaTests(TransactionTestCase):
|
||||||
Tests adding fields to models with a default that is not directly
|
Tests adding fields to models with a default that is not directly
|
||||||
valid in the database (#22581)
|
valid in the database (#22581)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class TestTransformField(IntegerField):
|
class TestTransformField(IntegerField):
|
||||||
|
|
||||||
# Weird field that saves the count of items in its value
|
# Weird field that saves the count of items in its value
|
||||||
def get_default(self):
|
def get_default(self):
|
||||||
return self.default
|
return self.default
|
||||||
|
|
||||||
def get_prep_value(self, value):
|
def get_prep_value(self, value):
|
||||||
if value is None:
|
if value is None:
|
||||||
return 0
|
return 0
|
||||||
return len(value)
|
return len(value)
|
||||||
|
|
||||||
# Create the table
|
# Create the table
|
||||||
with connection.schema_editor() as editor:
|
with connection.schema_editor() as editor:
|
||||||
editor.create_model(Author)
|
editor.create_model(Author)
|
||||||
|
|
Loading…
Reference in New Issue