This commit is contained in:
Nabil Ben Youssef 2025-01-23 10:17:26 +00:00 committed by GitHub
commit 329c60262b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -560,11 +560,9 @@ class EndpointSpec(dict):
def convert_service_ports(ports):
if isinstance(ports, list):
return ports
if not isinstance(ports, dict):
raise TypeError(
'Invalid type for ports, expected dict or list'
'Invalid type for ports, expected dict'
)
result = []

View File

@ -491,3 +491,9 @@ class ServicePortsTest(unittest.TestCase):
} in converted_ports
assert len(converted_ports) == 3
def test_convert_service_ports_wrong_ports_type(self):
ports = 'ports_as_string'
with pytest.raises(TypeError):
convert_service_ports(ports)