kevinjqliu commented on code in PR #1629: URL: https://github.com/apache/iceberg-python/pull/1629#discussion_r1960222618
########## tests/catalog/test_sql.py: ########## @@ -1117,17 +1117,30 @@ def test_create_namespace_with_empty_identifier(catalog: SqlCatalog, empty_names lazy_fixture("catalog_sqlite"), ], ) -@pytest.mark.parametrize("namespace_list", [lazy_fixture("database_list"), lazy_fixture("hierarchical_namespace_list")]) -def test_list_namespaces(catalog: SqlCatalog, namespace_list: List[str]) -> None: +def test_list_namespaces(catalog: SqlCatalog) -> None: + namespace_list = ["db", "db.ns1", "db.ns1.ns2", "db.ns2", "db2", "db2.ns1", "db%"] for namespace in namespace_list: catalog.create_namespace(namespace) - # Test global list + ns_list = catalog.list_namespaces() - for namespace in namespace_list: - assert Catalog.identifier_to_tuple(namespace) in ns_list - # Test individual namespace list - assert len(one_namespace := catalog.list_namespaces(namespace)) == 1 - assert Catalog.identifier_to_tuple(namespace) == one_namespace[0] + expected_list: list[tuple[str, ...]] = [("db",), ("db2",), ("db%",)] + for ns in expected_list: + assert ns in ns_list + + ns_list = catalog.list_namespaces("db") + expected_list = [("db", "ns1"), ("db", "ns2")] + assert len(ns_list) == len(expected_list) + for ns in expected_list: + assert ns in ns_list + + ns_list = catalog.list_namespaces("db.ns1") + expected_list = [("db", "ns1", "ns2")] + assert len(ns_list) == len(expected_list) + for ns in expected_list: + assert ns in ns_list + + ns_list = catalog.list_namespaces("db.ns1.ns2") + assert len(ns_list) == 0 Review Comment: @alessandro-nori could you also add this test? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org