From bfe773bfc8a37981faec2c27ea3ba65aa04f5c5d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 28 Mar 2018 07:30:14 -0300 Subject: [PATCH] Use shorter 'if kwargs' check as requested during review --- _pytest/python_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/python_api.py b/_pytest/python_api.py index 5e4776ce3..0b30b7ac8 100644 --- a/_pytest/python_api.py +++ b/_pytest/python_api.py @@ -597,7 +597,7 @@ def raises(expected_exception, *args, **kwargs): message = kwargs.pop("message") if "match" in kwargs: match_expr = kwargs.pop("match") - if len(kwargs.keys()) > 0: + if kwargs: msg = 'Unexpected keyword arguments passed to pytest.raises: ' msg += ', '.join(kwargs.keys()) raise TypeError(msg)