This is an automated email from the ASF dual-hosted git repository.

kevinjqliu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 8432b111 Fix list namespace response in rest catalog (#995)
8432b111 is described below

commit 8432b111aaa339b0fee2ac68345232c6f3b1d36b
Author: Andre Luis Anastacio <[email protected]>
AuthorDate: Tue Aug 6 19:38:25 2024 -0300

    Fix list namespace response in rest catalog (#995)
---
 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 6977dce7..813398fa 100644
--- a/pyiceberg/catalog/rest.py
+++ b/pyiceberg/catalog/rest.py
@@ -758,8 +758,7 @@ class RestCatalog(Catalog):
         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 86b6baef..fe9a32fe 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,
     )

Reply via email to