Skip to content

Commit a385f23

Browse files
authored
Merge branch 'apache:main' into load_view
2 parents e61d488 + 3a993e8 commit a385f23

4 files changed

Lines changed: 43 additions & 3 deletions

File tree

.github/workflows/pypi-build-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
if: matrix.os == 'ubuntu-latest'
6969

7070
- name: Build wheels
71-
uses: pypa/cibuildwheel@ee02a1537ce3071a004a6b08c41e72f0fdc42d9a # v3.4.0
71+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
7272
with:
7373
output-dir: wheelhouse
7474
config-file: "pyproject.toml"

.github/workflows/svn-build-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
if: matrix.os == 'ubuntu-latest'
6363

6464
- name: Build wheels
65-
uses: pypa/cibuildwheel@ee02a1537ce3071a004a6b08c41e72f0fdc42d9a # v3.4.0
65+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
6666
with:
6767
output-dir: wheelhouse
6868
config-file: "pyproject.toml"

pyiceberg/catalog/rest/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,14 @@ class ListNamespaceResponse(IcebergBaseModel):
340340

341341
class NamespaceResponse(IcebergBaseModel):
342342
namespace: Identifier = Field()
343-
properties: Properties = Field()
343+
properties: Properties = Field(default_factory=dict)
344+
345+
@field_validator("properties", mode="before")
346+
@classmethod
347+
def replace_none_with_dict(cls, v: Any) -> Properties:
348+
if v is None:
349+
return {}
350+
return v
344351

345352

346353
class UpdateNamespacePropertiesResponse(IcebergBaseModel):

tests/catalog/test_rest.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,39 @@ def test_load_namespace_properties_200(rest_mock: Mocker) -> None:
923923
assert RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).load_namespace_properties(namespace) == {"prop": "yes"}
924924

925925

926+
def test_load_namespace_properties_200_without_properties(rest_mock: Mocker) -> None:
927+
namespace = "leden"
928+
rest_mock.get(
929+
f"{TEST_URI}v1/namespaces/{namespace}",
930+
json={"namespace": ["leden"]},
931+
status_code=200,
932+
request_headers=TEST_HEADERS,
933+
)
934+
assert RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).load_namespace_properties(namespace) == {}
935+
936+
937+
def test_load_namespace_properties_200_with_null_properties(rest_mock: Mocker) -> None:
938+
namespace = "leden"
939+
rest_mock.get(
940+
f"{TEST_URI}v1/namespaces/{namespace}",
941+
json={"namespace": ["leden"], "properties": None},
942+
status_code=200,
943+
request_headers=TEST_HEADERS,
944+
)
945+
assert RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).load_namespace_properties(namespace) == {}
946+
947+
948+
def test_load_namespace_properties_200_with_empty_properties(rest_mock: Mocker) -> None:
949+
namespace = "leden"
950+
rest_mock.get(
951+
f"{TEST_URI}v1/namespaces/{namespace}",
952+
json={"namespace": ["leden"], "properties": {}},
953+
status_code=200,
954+
request_headers=TEST_HEADERS,
955+
)
956+
assert RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN).load_namespace_properties(namespace) == {}
957+
958+
926959
def test_load_namespace_properties_404(rest_mock: Mocker) -> None:
927960
namespace = "leden"
928961
rest_mock.get(

0 commit comments

Comments
 (0)