kevinjqliu commented on code in PR #1629:
URL: https://github.com/apache/iceberg-python/pull/1629#discussion_r1960226036
##########
tests/catalog/test_sql.py:
##########
@@ -1117,17 +1117,30 @@ def
test_create_namespace_with_empty_identifier(catalog: SqlCatalog, empty_names
lazy_fixture("catalog_sqlite"),
],
)
[email protected]("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:
huh, maybe something like this then
```
assert all(namespace in catalog.list_namespaces() for namespace in [("db",),
("db%",), ("db2",)])
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]