summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_autodetector.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
index dd153d2f0b..d2f9be75f7 100644
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -5314,6 +5314,20 @@ class MigrationSuggestNameTests(SimpleTestCase):
migration = Migration("some_migration", "test_app")
self.assertIs(migration.suggest_name().startswith("auto_"), True)
+ def test_operation_with_invalid_chars_in_suggested_name(self):
+ class Migration(migrations.Migration):
+ operations = [
+ migrations.AddConstraint(
+ "Person",
+ models.UniqueConstraint(
+ fields=["name"], name="person.name-*~unique!"
+ ),
+ ),
+ ]
+
+ migration = Migration("some_migration", "test_app")
+ self.assertEqual(migration.suggest_name(), "person_person_name_unique_")
+
def test_none_name(self):
class Migration(migrations.Migration):
operations = [migrations.RunSQL("SELECT 1 FROM person;")]