mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24859 -- Made QuerySet.get() with UUIDField raise TypeError on bad value.
For consistency with AutoField.
This commit is contained in:
@@ -37,6 +37,13 @@ class TestSaveLoad(TestCase):
|
||||
loaded = NullableUUIDModel.objects.get()
|
||||
self.assertEqual(loaded.field, None)
|
||||
|
||||
def test_pk_validated(self):
|
||||
with self.assertRaisesMessage(TypeError, 'is not a valid UUID'):
|
||||
PrimaryKeyUUIDModel.objects.get(pk={})
|
||||
|
||||
with self.assertRaisesMessage(TypeError, 'is not a valid UUID'):
|
||||
PrimaryKeyUUIDModel.objects.get(pk=[])
|
||||
|
||||
def test_wrong_value(self):
|
||||
self.assertRaisesMessage(
|
||||
ValueError, 'badly formed hexadecimal UUID string',
|
||||
|
||||
Reference in New Issue
Block a user