summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_writer.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index 3839f78cbd..f6c866d725 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -167,9 +167,17 @@ class WriterTests(TestCase):
self.assertEqual(string, "django.core.validators.EmailValidator(message='hello')")
self.serialize_round_trip(validator)
- validator = deconstructible(path="custom.EmailValidator")(EmailValidator)(message="hello")
+ validator = deconstructible(path="migrations.test_writer.EmailValidator")(EmailValidator)(message="hello")
string = MigrationWriter.serialize(validator)[0]
- self.assertEqual(string, "custom.EmailValidator(message='hello')")
+ self.assertEqual(string, "migrations.test_writer.EmailValidator(message='hello')")
+
+ validator = deconstructible(path="custom.EmailValidator")(EmailValidator)(message="hello")
+ with self.assertRaisesMessage(ImportError, "No module named 'custom'"):
+ MigrationWriter.serialize(validator)
+
+ validator = deconstructible(path="django.core.validators.EmailValidator2")(EmailValidator)(message="hello")
+ with self.assertRaisesMessage(ValueError, "Could not find object EmailValidator2 in django.core.validators."):
+ MigrationWriter.serialize(validator)
def test_serialize_empty_nonempty_tuple(self):
"""