forked from django/django
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #26022 -- Used context manager version of assertRaises in tests.
- Loading branch information
Showing
118 changed files
with
1,086 additions
and
760 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -429,7 +429,8 @@ def setUp(self): | |
self.user = User.objects.create_user('test', '[email protected]', 'test') | ||
|
||
def test_raises_exception(self): | ||
self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),)) | ||
with self.assertRaises(ImproperlyConfigured): | ||
self.user.has_perm(('perm', TestObj())) | ||
|
||
|
||
@override_settings(AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend']) | ||
|
@@ -575,7 +576,8 @@ def setUp(self): | |
|
||
@override_settings(AUTHENTICATION_BACKENDS=[backend]) | ||
def test_type_error_raised(self): | ||
self.assertRaises(TypeError, authenticate, username='test', password='test') | ||
with self.assertRaises(TypeError): | ||
authenticate(username='test', password='test') | ||
|
||
|
||
class ImproperlyConfiguredUserModelTest(TestCase): | ||
|
@@ -598,7 +600,8 @@ def test_does_not_shadow_exception(self): | |
request = HttpRequest() | ||
request.session = self.client.session | ||
|
||
self.assertRaises(ImproperlyConfigured, get_user, request) | ||
with self.assertRaises(ImproperlyConfigured): | ||
get_user(request) | ||
|
||
|
||
class ImportedModelBackend(ModelBackend): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.