1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Used assertRaisesMessage() in various tests.

This commit is contained in:
Hasan Ramezani
2020-02-04 21:58:07 +01:00
committed by Mariusz Felisiak
parent 71756bdfed
commit fc4f45ebdc
8 changed files with 59 additions and 101 deletions

View File

@@ -79,9 +79,8 @@ class SerializerRegistrationTests(SimpleTestCase):
serializers.get_serializer("nonsense")
# SerializerDoesNotExist is instantiated with the nonexistent format
with self.assertRaises(SerializerDoesNotExist) as cm:
with self.assertRaisesMessage(SerializerDoesNotExist, 'nonsense'):
serializers.get_serializer("nonsense")
self.assertEqual(cm.exception.args, ("nonsense",))
def test_get_unknown_deserializer(self):
with self.assertRaises(SerializerDoesNotExist):