mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
[1.10.x] Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
Backport of c9ae09addf from master
This commit is contained in:
@@ -193,13 +193,10 @@ class GetOrCreateTestsWithManualPKs(TestCase):
|
||||
|
||||
def test_get_or_create_empty(self):
|
||||
"""
|
||||
Regression test for #16137: get_or_create does not require kwargs.
|
||||
If all the attributes on a model have defaults, get_or_create() doesn't
|
||||
require any arguments.
|
||||
"""
|
||||
try:
|
||||
DefaultPerson.objects.get_or_create()
|
||||
except AssertionError:
|
||||
self.fail("If all the attributes on a model have defaults, we "
|
||||
"shouldn't need to pass any arguments.")
|
||||
DefaultPerson.objects.get_or_create()
|
||||
|
||||
|
||||
class GetOrCreateTransactionTests(TransactionTestCase):
|
||||
|
||||
Reference in New Issue
Block a user