summaryrefslogtreecommitdiff
path: root/tests/get_or_create
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-06-28 11:21:26 -0400
committerGitHub <noreply@github.com>2016-06-28 11:21:26 -0400
commitc9ae09addffb839403312131d4251e9d8b454508 (patch)
tree74913fbe2e90d88e094f8594947ebf313ec5f12f /tests/get_or_create
parentc1b6f554e405fe733e8d80f7e3d77c277810e707 (diff)
downloaddjango-c9ae09addffb839403312131d4251e9d8b454508.tar.gz
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
Diffstat (limited to 'tests/get_or_create')
-rw-r--r--tests/get_or_create/tests.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py
index 84f8261a92..567ad880fa 100644
--- a/tests/get_or_create/tests.py
+++ b/tests/get_or_create/tests.py
@@ -212,13 +212,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):