diff options
author | Tim Graham <timograham@gmail.com> | 2016-06-28 11:21:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 11:21:26 -0400 |
commit | c9ae09addffb839403312131d4251e9d8b454508 (patch) | |
tree | 74913fbe2e90d88e094f8594947ebf313ec5f12f /tests/generic_views | |
parent | c1b6f554e405fe733e8d80f7e3d77c277810e707 (diff) | |
download | django-c9ae09addffb839403312131d4251e9d8b454508.tar.gz |
Replaced use of TestCase.fail() with assertRaises().
Also removed try/except/fail antipattern that hides exceptions.
Diffstat (limited to 'tests/generic_views')
-rw-r--r-- | tests/generic_views/test_base.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py index a5e528585c..db4ef604fa 100644 --- a/tests/generic_views/test_base.py +++ b/tests/generic_views/test_base.py @@ -78,21 +78,15 @@ class ViewTest(unittest.TestCase): """ Test that a view can't be accidentally instantiated before deployment """ - try: + with self.assertRaises(AttributeError): SimpleView(key='value').as_view() - self.fail('Should not be able to instantiate a view') - except AttributeError: - pass def test_no_init_args(self): """ Test that a view can't be accidentally instantiated before deployment """ - try: + with self.assertRaises(TypeError): SimpleView.as_view('value') - self.fail('Should not be able to use non-keyword arguments instantiating a view') - except TypeError: - pass def test_pathological_http_method(self): """ |