diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index a5bfadee831..e11dfdd9134 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -189,7 +189,7 @@ def redirect_to(*args, **kw): _url = '' skip_url_parsing = False parse_url = kw.pop('parse_url', False) - if uargs and len(uargs) is 1 and isinstance(uargs[0], string_types) \ + if uargs and len(uargs) == 1 and isinstance(uargs[0], string_types) \ and (uargs[0].startswith('/') or is_url(uargs[0])) \ and parse_url is False: skip_url_parsing = True diff --git a/ckan/plugins/toolkit.py b/ckan/plugins/toolkit.py index da2fbcd8cca..ce107f0f20f 100644 --- a/ckan/plugins/toolkit.py +++ b/ckan/plugins/toolkit.py @@ -475,7 +475,7 @@ def _get_endpoint(cls): # there are some routes('hello_world') that are not using blueprint # For such case, let's assume that view function is a controller # itself and action is None. - if len(endpoint) is 1: + if len(endpoint) == 1: return endpoint + (None,) return endpoint diff --git a/ckan/tests/legacy/functional/test_pagination.py b/ckan/tests/legacy/functional/test_pagination.py index 72443669dd9..f4fad6005d7 100644 --- a/ckan/tests/legacy/functional/test_pagination.py +++ b/ckan/tests/legacy/functional/test_pagination.py @@ -10,7 +10,7 @@ def scrape_search_results(response, object_type): assert object_type in ('dataset', 'group_dataset', 'group', 'user') - if object_type is not 'group_dataset': + if object_type != 'group_dataset': results = re.findall('a href="/%s/%s_(\d\d)' % (object_type, object_type), str(response)) else: diff --git a/ckan/tests/legacy/logic/test_action.py b/ckan/tests/legacy/logic/test_action.py index ccb1a253c7f..4d569da40e1 100644 --- a/ckan/tests/legacy/logic/test_action.py +++ b/ckan/tests/legacy/logic/test_action.py @@ -702,7 +702,7 @@ def test_42_resource_search_test_percentage_is_escaped(self): # There shouldn't be any results. If the '%' character wasn't # escaped correctly, then the search would match because of the # unescaped wildcard. - assert count is 0 + assert count == 0 def test_42_resource_search_fields_parameter_still_accepted(self): '''The fields parameter is deprecated, but check it still works.