diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-05-03 16:39:16 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-05-03 16:39:16 +0200 |
| commit | b52672d77822e88752cb178c8a359adde83ff0ba (patch) | |
| tree | 5289bd86172caf66b0b37dfe21737b757777c8f0 /tests/modeltests | |
| parent | e84f79f05113f546810c1908c7baef99fb1e874a (diff) | |
Replaced deprecated TestCase methods. Refs #17049.
Diffstat (limited to 'tests/modeltests')
| -rw-r--r-- | tests/modeltests/prefetch_related/tests.py | 12 | ||||
| -rw-r--r-- | tests/modeltests/select_for_update/tests.py | 4 | ||||
| -rw-r--r-- | tests/modeltests/test_client/models.py | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/tests/modeltests/prefetch_related/tests.py b/tests/modeltests/prefetch_related/tests.py index 51a9b698f6..5cd42a75c0 100644 --- a/tests/modeltests/prefetch_related/tests.py +++ b/tests/modeltests/prefetch_related/tests.py @@ -341,7 +341,7 @@ class MultiTableInheritanceTest(TestCase): qs = AuthorWithAge.objects.prefetch_related('addresses') addresses = [[unicode(address) for address in obj.addresses.all()] for obj in qs] - self.assertEquals(addresses, [[unicode(self.authorAddress)], [], []]) + self.assertEqual(addresses, [[unicode(self.authorAddress)], [], []]) def test_m2m_to_inheriting_model(self): qs = AuthorWithAge.objects.prefetch_related('books_with_year') @@ -351,7 +351,7 @@ class MultiTableInheritanceTest(TestCase): qs = AuthorWithAge.objects.all() lst2 = [[unicode(book) for book in author.books_with_year.all()] for author in qs] - self.assertEquals(lst, lst2) + self.assertEqual(lst, lst2) qs = BookWithYear.objects.prefetch_related('aged_authors') with self.assertNumQueries(2): @@ -360,7 +360,7 @@ class MultiTableInheritanceTest(TestCase): qs = BookWithYear.objects.all() lst2 = [[unicode(author) for author in book.aged_authors.all()] for book in qs] - self.assertEquals(lst, lst2) + self.assertEqual(lst, lst2) def test_parent_link_prefetch(self): with self.assertNumQueries(2): @@ -402,7 +402,7 @@ class ForeignKeyToFieldTest(TestCase): qs = Author.objects.prefetch_related('addresses') addresses = [[unicode(address) for address in obj.addresses.all()] for obj in qs] - self.assertEquals(addresses, [[unicode(self.authorAddress)], [], []]) + self.assertEqual(addresses, [[unicode(self.authorAddress)], [], []]) def test_m2m(self): with self.assertNumQueries(3): @@ -411,7 +411,7 @@ class ForeignKeyToFieldTest(TestCase): [unicode(i_like) for i_like in author.favorite_authors.all()], [unicode(likes_me) for likes_me in author.favors_me.all()] ) for author in qs] - self.assertEquals( + self.assertEqual( favorites, [ ([unicode(self.author2)],[unicode(self.author3)]), @@ -549,7 +549,7 @@ class MultiDbTests(TestCase): authors = "".join(["%s: %s\n" % (author.name, ", ".join(b.title for b in author.books.all())) for author in qs2]) - self.assertEquals(authors, + self.assertEqual(authors, "Charlotte: Poems, Jane Eyre\n" "Anne: Poems\n" "Emily: Poems, Wuthering Heights\n" diff --git a/tests/modeltests/select_for_update/tests.py b/tests/modeltests/select_for_update/tests.py index 0587e11a3a..243f6b50e7 100644 --- a/tests/modeltests/select_for_update/tests.py +++ b/tests/modeltests/select_for_update/tests.py @@ -80,7 +80,7 @@ class SelectForUpdateTests(TransactionTestCase): return bool(sql.find(for_update_sql) > -1) def check_exc(self, exc): - self.failUnless(isinstance(exc, DatabaseError)) + self.assertTrue(isinstance(exc, DatabaseError)) @skipUnlessDBFeature('has_select_for_update') def test_for_update_sql_generated(self): @@ -217,7 +217,7 @@ class SelectForUpdateTests(TransactionTestCase): # Check the thread has finished. Assuming it has, we should # find that it has updated the person's name. - self.failIf(thread.isAlive()) + self.assertFalse(thread.isAlive()) # We must commit the transaction to ensure that MySQL gets a fresh read, # since by default it runs in REPEATABLE READ mode diff --git a/tests/modeltests/test_client/models.py b/tests/modeltests/test_client/models.py index cfbb4fba7a..a533d6a280 100644 --- a/tests/modeltests/test_client/models.py +++ b/tests/modeltests/test_client/models.py @@ -378,7 +378,7 @@ class ClientTest(TestCase): # Get the page without logging in. Should result in 403. response = self.client.get('/test_client/permission_protected_view_exception/') - self.assertEquals(response.status_code, 403) + self.assertEqual(response.status_code, 403) # Log in login = self.client.login(username='testclient', password='password') @@ -386,7 +386,7 @@ class ClientTest(TestCase): # Log in with wrong permissions. Should result in 403. response = self.client.get('/test_client/permission_protected_view_exception/') - self.assertEquals(response.status_code, 403) + self.assertEqual(response.status_code, 403) def test_view_with_method_permissions(self): "Request a page that is protected with a @permission_required method" |
