Skip to content

Commit 6ac4940

Browse files
committed
Align name logic
1 parent 7c92c4b commit 6ac4940

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/databricks/labs/pytester/fixtures/catalog.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def create( # pylint: disable=too-many-locals,too-many-arguments,too-many-state
118118
schema = make_schema(catalog_name=catalog_name)
119119
catalog_name = schema.catalog_name
120120
schema_name = schema.name
121-
if name is None:
122-
name = f"dummy_t{make_random(4).lower()}"
121+
name = name or f"dummy_t{make_random(4).lower()}"
123122
table_type: TableType | None = None
124123
data_source_format = None
125124
storage_location = None
@@ -264,8 +263,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table):
264263
"""
265264

266265
def create(*, catalog_name: str = "hive_metastore", name: str | None = None) -> SchemaInfo:
267-
if name is None:
268-
name = f"dummy_s{make_random(4)}".lower()
266+
name = name or f"dummy_s{make_random(4)}".lower()
269267
full_name = f"{catalog_name}.{name}".lower()
270268
sql_backend.execute(f"CREATE SCHEMA {full_name} WITH DBPROPERTIES (RemoveAfter={watchdog_remove_after})")
271269
schema_info = SchemaInfo(catalog_name=catalog_name, name=name, full_name=full_name)
@@ -353,8 +351,7 @@ def create(
353351
catalog_name = schema.catalog_name
354352
schema_name = schema.name
355353

356-
if name is None:
357-
name = f"dummy_f{make_random(4)}".lower()
354+
name = name or f"dummy_f{make_random(4)}".lower()
358355

359356
# Note: the Watchdog does not explicitly scan for functions; they are purged along with their parent schema.
360357
# As such the function can't be marked (and doesn't need to be if the schema as marked) for purge protection.

0 commit comments

Comments
 (0)