diff options
Diffstat (limited to 'tests/model_forms')
| -rw-r--r-- | tests/model_forms/test_uuid.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_forms/test_uuid.py b/tests/model_forms/test_uuid.py index 4dc7d511d7..b30da6d465 100644 --- a/tests/model_forms/test_uuid.py +++ b/tests/model_forms/test_uuid.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals from django import forms +from django.core.exceptions import ValidationError from django.test import TestCase from .models import UUIDPK @@ -27,3 +28,8 @@ class ModelFormBaseTest(TestCase): msg = "The UUIDPK could not be changed because the data didn't validate." with self.assertRaisesMessage(ValueError, msg): form.save() + + def test_model_multiple_choice_field_uuid_pk(self): + f = forms.ModelMultipleChoiceField(UUIDPK.objects.all()) + with self.assertRaisesMessage(ValidationError, "'invalid_uuid' is not a valid UUID."): + f.clean(['invalid_uuid']) |
