Fixed typos in migrations tests, comments, and error message.

This commit is contained in:
Jacob Walls 2021-07-15 12:35:28 -04:00 committed by Mariusz Felisiak
parent 52f9cfee9f
commit 202d3e193a
3 changed files with 7 additions and 4 deletions

View File

@ -32,7 +32,7 @@ class Command(BaseCommand):
# Get the database we're operating from
connection = connections[options['database']]
# Load up an loader to get all the migration data, but don't replace
# Load up a loader to get all the migration data, but don't replace
# migrations.
loader = MigrationLoader(connection, replace_migrations=False)

View File

@ -149,7 +149,10 @@ class MigrationLoader:
"There is more than one migration for '%s' with the prefix '%s'" % (app_label, name_prefix)
)
elif not results:
raise KeyError("There no migrations for '%s' with the prefix '%s'" % (app_label, name_prefix))
raise KeyError(
f"There is no migration for '{app_label}' with the prefix "
f"'{name_prefix}'"
)
else:
return self.disk_migrations[results[0]]

View File

@ -182,7 +182,7 @@ class LoaderTests(TestCase):
msg = "There is more than one migration for 'migrations' with the prefix '0'"
with self.assertRaisesMessage(AmbiguityError, msg):
migration_loader.get_migration_by_prefix("migrations", "0")
msg = "There no migrations for 'migrations' with the prefix 'blarg'"
msg = "There is no migration for 'migrations' with the prefix 'blarg'"
with self.assertRaisesMessage(KeyError, msg):
migration_loader.get_migration_by_prefix("migrations", "blarg")
@ -299,7 +299,7 @@ class LoaderTests(TestCase):
loader.build_graph()
self.assertEqual(num_nodes(), 3)
# Starting at 5 to 7 we are passed the squashed migrations
# Starting at 5 to 7 we are past the squashed migrations.
self.record_applied(recorder, 'migrations', '5_auto')
loader.build_graph()
self.assertEqual(num_nodes(), 2)