@@ -312,7 +312,7 @@ def test_rename_table(catalog: InMemoryCatalog) -> None:
312312 assert table ._identifier == Catalog .identifier_to_tuple (new_table )
313313
314314 # And
315- assert ( "new" ,) in catalog .list_namespaces ( )
315+ assert catalog ._namespace_exists ( table . _identifier [: - 1 ] )
316316
317317 # And
318318 with pytest .raises (NoSuchTableError , match = NO_SUCH_TABLE_ERROR ):
@@ -336,7 +336,7 @@ def test_rename_table_from_self_identifier(catalog: InMemoryCatalog) -> None:
336336 assert new_table ._identifier == Catalog .identifier_to_tuple (new_table_name )
337337
338338 # And
339- assert ( "new" ,) in catalog .list_namespaces ( )
339+ assert catalog ._namespace_exists ( new_table . _identifier [: - 1 ] )
340340
341341 # And
342342 with pytest .raises (NoSuchTableError , match = NO_SUCH_TABLE_ERROR ):
@@ -350,7 +350,7 @@ def test_create_namespace(catalog: InMemoryCatalog) -> None:
350350 catalog .create_namespace (TEST_TABLE_NAMESPACE , TEST_TABLE_PROPERTIES )
351351
352352 # Then
353- assert TEST_TABLE_NAMESPACE [: 1 ] in catalog .list_namespaces ( )
353+ assert catalog ._namespace_exists ( TEST_TABLE_NAMESPACE )
354354 assert TEST_TABLE_PROPERTIES == catalog .load_namespace_properties (TEST_TABLE_NAMESPACE )
355355
356356
@@ -375,14 +375,19 @@ def test_list_namespaces(catalog: InMemoryCatalog) -> None:
375375 # Then
376376 assert TEST_TABLE_NAMESPACE [:1 ] in namespaces
377377
378+ # When
379+ namespaces = catalog .list_namespaces (TEST_TABLE_NAMESPACE )
380+ # Then
381+ assert not namespaces
382+
378383
379384def test_drop_namespace (catalog : InMemoryCatalog ) -> None :
380385 # Given
381386 catalog .create_namespace (TEST_TABLE_NAMESPACE , TEST_TABLE_PROPERTIES )
382387 # When
383388 catalog .drop_namespace (TEST_TABLE_NAMESPACE )
384389 # Then
385- assert TEST_TABLE_NAMESPACE [: 1 ] not in catalog .list_namespaces ( )
390+ assert not catalog ._namespace_exists ( TEST_TABLE_NAMESPACE )
386391
387392
388393def test_drop_namespace_raises_error_when_namespace_does_not_exist (catalog : InMemoryCatalog ) -> None :
@@ -431,7 +436,7 @@ def test_update_namespace_metadata(catalog: InMemoryCatalog) -> None:
431436 summary = catalog .update_namespace_properties (TEST_TABLE_NAMESPACE , updates = new_metadata )
432437
433438 # Then
434- assert TEST_TABLE_NAMESPACE [: 1 ] in catalog .list_namespaces ( )
439+ assert catalog ._namespace_exists ( TEST_TABLE_NAMESPACE )
435440 assert new_metadata .items () <= catalog .load_namespace_properties (TEST_TABLE_NAMESPACE ).items ()
436441 assert summary .removed == []
437442 assert sorted (summary .updated ) == ["key3" , "key4" ]
@@ -448,7 +453,7 @@ def test_update_namespace_metadata_removals(catalog: InMemoryCatalog) -> None:
448453 summary = catalog .update_namespace_properties (TEST_TABLE_NAMESPACE , remove_metadata , new_metadata )
449454
450455 # Then
451- assert TEST_TABLE_NAMESPACE [: 1 ] in catalog .list_namespaces ( )
456+ assert catalog ._namespace_exists ( TEST_TABLE_NAMESPACE )
452457 assert new_metadata .items () <= catalog .load_namespace_properties (TEST_TABLE_NAMESPACE ).items ()
453458 assert remove_metadata .isdisjoint (catalog .load_namespace_properties (TEST_TABLE_NAMESPACE ).keys ())
454459 assert summary .removed == ["key1" ]
0 commit comments