Skip to content

Commit

Permalink
Mypy and Pylint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed May 27, 2024
1 parent 29bf2a1 commit f3b98b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion openatlas/api/endpoints/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
6 changes: 3 additions & 3 deletions openatlas/display/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
29 changes: 9 additions & 20 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f3b98b8

Please sign in to comment.