alessandro-nori commented on code in PR #1629: URL: https://github.com/apache/iceberg-python/pull/1629#discussion_r1957078977
########## 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 Review Comment: Another note, the first `assert ns_list == expected_list` does not work as expected because the catalog contains other namespaces created in other tests. ``` ns_list = catalog.list_namespaces() > assert sorted(ns_list) == [("db",), ("db%",), ("db2",)] E AssertionError: assert [('db',), ('d...t_new',), ...] == [('db',), ('db%',), ('db2',)] E Left contains 109 more items, first extra item: ('my_iceberg_database-alcotyqwtpiqunaddobf',) ``` -- 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