diff options
Diffstat (limited to 'tests/test_api.py')
-rw-r--r-- | tests/test_api.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index e37d5cf..1829b1d 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -336,20 +336,12 @@ class TestUndefined(object): pytest.raises(UndefinedError, t.render, var=0) def test_none_gives_proper_error(self): - try: + with pytest.raises(UndefinedError, match= "'None' has no attribute 'split'"): Environment().getattr(None, 'split')() - except UndefinedError as e: - assert e.message == "'None' has no attribute 'split'" - else: - assert False, 'expected exception' def test_object_repr(self): - try: + with pytest.raises(UndefinedError, match="'int object' has no attribute 'upper'"): Undefined(obj=42, name='upper')() - except UndefinedError as e: - assert e.message == "'int object' has no attribute 'upper'" - else: - assert False, 'expected exception' @pytest.mark.api |