From f3b98b874e809485f38a5dcf8631f655703a759b Mon Sep 17 00:00:00 2001 From: Alexander Watzinger Date: Mon, 27 May 2024 13:06:21 +0200 Subject: [PATCH] Mypy and Pylint checks --- openatlas/api/endpoints/special.py | 2 +- openatlas/display/util.py | 6 +++--- tests/test_api.py | 29 +++++++++-------------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/openatlas/api/endpoints/special.py b/openatlas/api/endpoints/special.py index f816bc70f..78c706f66 100644 --- a/openatlas/api/endpoints/special.py +++ b/openatlas/api/endpoints/special.py @@ -115,7 +115,7 @@ def get() -> tuple[Resource, int] | Response | dict[str, Any]: results: dict[str, Any] = {'results': []} for id_, dict_ in output.items(): if linked_to_id := parser.linked_to_ids: - if not (set(linked_to_id) & set(dict_['relations'])): + if not set(linked_to_id) & set(dict_['relations']): continue dict_['id'] = id_ results['results'].append(dict_) diff --git a/openatlas/display/util.py b/openatlas/display/util.py index 09fa5057b..7d788b6c1 100644 --- a/openatlas/display/util.py +++ b/openatlas/display/util.py @@ -308,9 +308,9 @@ def get_base_table_data(entity: Entity, show_links: bool = True) -> list[Any]: if entity.class_.standard_type_id: data.append(entity.standard_type.name if entity.standard_type else '') if entity.class_.name == 'file': - data.append(_('yes') if entity.public else None), - data.append(entity.creator), - data.append(entity.license_holder), + data.append(_('yes') if entity.public else None) + data.append(entity.creator) + data.append(entity.license_holder) data.append(entity.get_file_size()) data.append(entity.get_file_ext()) if entity.class_.view in ['actor', 'artifact', 'event', 'place']: diff --git a/tests/test_api.py b/tests/test_api.py index 99ba220ff..51aaa5e16 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -52,7 +52,6 @@ def get_class_mapping(data: dict[str, Any], locale: str) -> bool: def test_api(self) -> None: with app.app_context(): - logo = Path(app.root_path) \ / 'static' / 'images' / 'layout' / 'logo.png' @@ -250,7 +249,9 @@ def test_api(self) -> None: links = rv['links'][0] assert self.get_bool(links, 'type', 'closeMatch') assert self.get_bool( - links, 'identifier', 'https://www.geonames.org/2761369') + links, + 'identifier', + 'https://www.geonames.org/2761369') assert self.get_bool(links, 'referenceSystem', 'GeoNames') assert self.get_bool(rv['geometry'], 'type', 'GeometryCollection') assert self.get_bool( @@ -320,18 +321,6 @@ def test_api(self) -> None: '41.0284940983463,28.9399641177912 41.0297647897435' ',28.9389559878606 41.0290525580955))') - # Problems because of - # issue 130 https://github.com/RDFLib/rdflib/issues/130 - # or GitHub Actions connection issues - # for rv in [ - # self.app.get( - # url_for('api_04.entity', id_=place.id, format='n3')), - # self.app.get(url_for( - # 'api_04.view_class', - # view_class='place', - # format='n3'))]: - # assert b'Shire' in rv.data - # Test Entity export and RDFS for rv in [ self.app.get( @@ -998,14 +987,14 @@ def test_api(self) -> None: '"logicalOperator":"xor"}]}')) assert 'Invalid logical operator' in rv.get_json()['title'] - rv = self.app.get(url_for( - 'api_04.display', - filename=f'{file_without_licences.id}')) + rv = self.app.get( + url_for( + 'api_04.display', + filename=f'{file_without_licences.id}')) assert 'No license' in rv.get_json()['title'] - rv = self.app.get(url_for( - 'api_04.display', - filename=f'{file_without_file.id}')) + rv = self.app.get( + url_for('api_04.display', filename=f'{file_without_file.id}')) assert 'File not found' in rv.get_json()['title'] assert b'Endpoint not found' in self.app.get('/api/entity2').data