|
49 | 49 | from pytest_lazy_fixtures import lf |
50 | 50 |
|
51 | 51 | from pyiceberg.catalog import Catalog, load_catalog |
| 52 | +from pyiceberg.catalog.bigquery_metastore import BigQueryMetastoreCatalog |
52 | 53 | from pyiceberg.catalog.dynamodb import DynamoDbCatalog |
53 | 54 | from pyiceberg.catalog.glue import GlueCatalog |
| 55 | +from pyiceberg.catalog.hive import HiveCatalog |
54 | 56 | from pyiceberg.catalog.memory import InMemoryCatalog |
55 | 57 | from pyiceberg.catalog.noop import NoopCatalog |
56 | 58 | from pyiceberg.catalog.rest import RestCatalog |
@@ -3152,52 +3154,46 @@ def test_table_properties() -> dict[str, str]: |
3152 | 3154 | def does_support_purge_table(catalog: Catalog) -> bool: |
3153 | 3155 | if isinstance(catalog, RestCatalog): |
3154 | 3156 | return property_as_bool(catalog.properties, "supports_purge_table", True) |
3155 | | - if _has_catalog_class_name(catalog, "HiveCatalog") or isinstance(catalog, NoopCatalog): |
| 3157 | + if isinstance(catalog, (HiveCatalog, NoopCatalog)): |
3156 | 3158 | return False |
3157 | 3159 | return True |
3158 | 3160 |
|
3159 | 3161 |
|
3160 | 3162 | def does_support_atomic_concurrent_updates(catalog: Catalog) -> bool: |
3161 | 3163 | if isinstance(catalog, RestCatalog): |
3162 | 3164 | return property_as_bool(catalog.properties, "supports_atomic_concurrent_updates", True) |
3163 | | - if _has_catalog_class_name(catalog, "HiveCatalog") or isinstance(catalog, NoopCatalog): |
| 3165 | + if isinstance(catalog, (HiveCatalog, NoopCatalog)): |
3164 | 3166 | return False |
3165 | 3167 | return True |
3166 | 3168 |
|
3167 | 3169 |
|
3168 | 3170 | def does_support_nested_namespaces(catalog: Catalog) -> bool: |
3169 | 3171 | if isinstance(catalog, RestCatalog): |
3170 | 3172 | return property_as_bool(catalog.properties, "supports_nested_namespaces", True) |
3171 | | - if _has_catalog_class_name(catalog, "HiveCatalog", "BigQueryMetastoreCatalog") or isinstance( |
3172 | | - catalog, (NoopCatalog, GlueCatalog, DynamoDbCatalog) |
3173 | | - ): |
| 3173 | + if isinstance(catalog, (HiveCatalog, NoopCatalog, GlueCatalog, BigQueryMetastoreCatalog, DynamoDbCatalog)): |
3174 | 3174 | return False |
3175 | 3175 | return True |
3176 | 3176 |
|
3177 | 3177 |
|
3178 | 3178 | def does_support_schema_evolution(catalog: Catalog) -> bool: |
3179 | 3179 | if isinstance(catalog, RestCatalog): |
3180 | 3180 | return property_as_bool(catalog.properties, "supports_schema_evolution", True) |
3181 | | - if _has_catalog_class_name(catalog, "HiveCatalog") or isinstance(catalog, NoopCatalog): |
| 3181 | + if isinstance(catalog, (HiveCatalog, NoopCatalog)): |
3182 | 3182 | return False |
3183 | 3183 | return True |
3184 | 3184 |
|
3185 | 3185 |
|
3186 | 3186 | def does_support_slash_in_identifier(catalog: Catalog) -> bool: |
3187 | 3187 | if isinstance(catalog, RestCatalog): |
3188 | 3188 | return property_as_bool(catalog.properties, "supports_slash_in_identifier", True) |
3189 | | - if _has_catalog_class_name(catalog, "HiveCatalog") or isinstance(catalog, (NoopCatalog, SqlCatalog)): |
| 3189 | + if isinstance(catalog, (HiveCatalog, NoopCatalog, SqlCatalog)): |
3190 | 3190 | return False |
3191 | 3191 | return True |
3192 | 3192 |
|
3193 | 3193 |
|
3194 | 3194 | def does_support_dot_in_identifier(catalog: Catalog) -> bool: |
3195 | 3195 | if isinstance(catalog, RestCatalog): |
3196 | 3196 | return property_as_bool(catalog.properties, "supports_dot_in_identifier", True) |
3197 | | - if _has_catalog_class_name(catalog, "HiveCatalog") or isinstance(catalog, (NoopCatalog, SqlCatalog)): |
| 3197 | + if isinstance(catalog, (HiveCatalog, NoopCatalog, SqlCatalog)): |
3198 | 3198 | return False |
3199 | 3199 | return True |
3200 | | - |
3201 | | - |
3202 | | -def _has_catalog_class_name(catalog: Catalog, *class_names: str) -> bool: |
3203 | | - return any(base.__name__ in class_names for base in type(catalog).__mro__) |
0 commit comments