From 1b796ca5ca3fb77c0c7b757c364f58e49d25cd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Anast=C3=A1cio?= Date: Sun, 4 Aug 2024 00:21:20 -0300 Subject: [PATCH] Fix list namespace response in rest catalog --- pyiceberg/catalog/rest.py | 3 +-- tests/catalog/test_rest.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyiceberg/catalog/rest.py b/pyiceberg/catalog/rest.py index 6977dce7d3..813398faec 100644 --- a/pyiceberg/catalog/rest.py +++ b/pyiceberg/catalog/rest.py @@ -758,8 +758,7 @@ def list_namespaces(self, namespace: Union[str, Identifier] = ()) -> List[Identi except HTTPError as exc: self._handle_non_200_response(exc, {}) - namespaces = ListNamespaceResponse(**response.json()) - return [namespace_tuple + child_namespace for child_namespace in namespaces.namespaces] + return ListNamespaceResponse(**response.json()).namespaces @retry(**_RETRY_ARGS) def load_namespace_properties(self, namespace: Union[str, Identifier]) -> Properties: diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py index 86b6baeff0..fe9a32fe41 100644 --- a/tests/catalog/test_rest.py +++ b/tests/catalog/test_rest.py @@ -419,7 +419,7 @@ def test_list_namespaces_200(rest_mock: Mocker) -> None: def test_list_namespace_with_parent_200(rest_mock: Mocker) -> None: rest_mock.get( f"{TEST_URI}v1/namespaces?parent=accounting", - json={"namespaces": [["tax"]]}, + json={"namespaces": [["accounting", "tax"]]}, status_code=200, request_headers=TEST_HEADERS, )