From c83861aa223bdac1731e100be4551ab0e1bc1852 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Wed, 28 May 2025 09:23:59 +0200 Subject: [PATCH] lint+types --- mapping_provider/backends/services.py | 5 +++-- test/test_map_endpoints.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mapping_provider/backends/services.py b/mapping_provider/backends/services.py index b07a896..7406a0e 100644 --- a/mapping_provider/backends/services.py +++ b/mapping_provider/backends/services.py @@ -1,4 +1,3 @@ -import functools import logging import re from collections.abc import Generator @@ -54,7 +53,9 @@ def endpoint_equipment(endpoint: dict[str, Any]) -> str: if 'hostname' in endpoint: return _hostname_to_equipment(endpoint['hostname']) elif 'equipment' in endpoint: - return endpoint['equipment'] + _name = endpoint['equipment'] + assert isinstance(_name, str) # mypy noise + return _name # should already be validated raise AssertionError(f'no equipment or hostname in endpoint: {endpoint}') diff --git a/test/test_map_endpoints.py b/test/test_map_endpoints.py index 113fa37..c3dbaba 100644 --- a/test/test_map_endpoints.py +++ b/test/test_map_endpoints.py @@ -76,7 +76,7 @@ def test_get_services(client, service_type): def test_get_unknown_service_type(client): - rv = client.get(f"/map/services/BOGUS_SERVICE_TYPE") + rv = client.get("/map/services/BOGUS_SERVICE_TYPE") assert rv.status_code == 404 -- GitLab