mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #23620 -- Used more specific assertions in the Django test suite.
This commit is contained in:
committed by
Tim Graham
parent
c0c78f1b70
commit
f7969b0920
@@ -113,7 +113,7 @@ class PrefetchRelatedTests(TestCase):
|
||||
70679243d1786e03557c28929f9762a119e3ac14.
|
||||
"""
|
||||
qs = Book.objects.prefetch_related('first_time_authors')
|
||||
self.assertTrue(qs[0] in qs)
|
||||
self.assertIn(qs[0], qs)
|
||||
|
||||
def test_clear(self):
|
||||
"""
|
||||
@@ -211,15 +211,15 @@ class PrefetchRelatedTests(TestCase):
|
||||
with self.assertRaises(AttributeError) as cm:
|
||||
list(qs)
|
||||
|
||||
self.assertTrue('prefetch_related' in str(cm.exception))
|
||||
self.assertIn('prefetch_related', str(cm.exception))
|
||||
|
||||
def test_invalid_final_lookup(self):
|
||||
qs = Book.objects.prefetch_related('authors__name')
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
list(qs)
|
||||
|
||||
self.assertTrue('prefetch_related' in str(cm.exception))
|
||||
self.assertTrue("name" in str(cm.exception))
|
||||
self.assertIn('prefetch_related', str(cm.exception))
|
||||
self.assertIn("name", str(cm.exception))
|
||||
|
||||
|
||||
class CustomPrefetchTests(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user