From 3a3cda58c69b9a9adec6a5ec49d4e797771bc589 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Tue, 25 Mar 2025 08:35:34 -0400 Subject: [PATCH] Fix erroneous use of "is" The `is` operator checks for identity, not equality. To check for an empty list, one should use either: if roles == []: Or just take advantage of the fact that an empty list is `False` when used in a boolean expression, and write: if not roles: This commit takes the second option. --- esileapclient/tests/functional/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esileapclient/tests/functional/base.py b/esileapclient/tests/functional/base.py index 0817347..634b551 100644 --- a/esileapclient/tests/functional/base.py +++ b/esileapclient/tests/functional/base.py @@ -121,7 +121,7 @@ def _init_dummy_project(self, name, roles, parent=None): 'domain': 'default' } - if roles is []: + if not roles: raise ValueError('No roles specified when initializing dummy \ project %s' % name) elif type(roles) is str: