@@ -37,10 +37,10 @@ def test_retain_last_n_snapshots(table_v2: Table) -> None:
37
37
(5 , 5000 ),
38
38
]
39
39
snapshots = _make_snapshots (ids_and_ts )
40
-
40
+
41
41
# Save original catalog for cleanup
42
42
original_catalog = table_v2 .catalog
43
-
43
+
44
44
try :
45
45
table_v2 .metadata = table_v2 .metadata .model_copy (update = {"snapshots" : snapshots , "refs" : {}})
46
46
table_v2 .catalog = MagicMock ()
@@ -61,7 +61,7 @@ def test_retain_last_n_snapshots(table_v2: Table) -> None:
61
61
finally :
62
62
# Restore original catalog and cleanup
63
63
table_v2 .catalog = original_catalog
64
- if hasattr (original_catalog , ' _connection' ) and original_catalog ._connection is not None :
64
+ if hasattr (original_catalog , " _connection" ) and original_catalog ._connection is not None :
65
65
try :
66
66
original_catalog ._connection .close ()
67
67
except Exception :
@@ -78,10 +78,10 @@ def test_min_snapshots_to_keep(table_v2: Table) -> None:
78
78
(5 , 5000 ),
79
79
]
80
80
snapshots = _make_snapshots (ids_and_ts )
81
-
81
+
82
82
# Save original catalog for cleanup
83
83
original_catalog = table_v2 .catalog
84
-
84
+
85
85
try :
86
86
table_v2 .metadata = table_v2 .metadata .model_copy (update = {"snapshots" : snapshots , "refs" : {}})
87
87
table_v2 .catalog = MagicMock ()
@@ -101,7 +101,7 @@ def test_min_snapshots_to_keep(table_v2: Table) -> None:
101
101
finally :
102
102
# Restore original catalog and cleanup
103
103
table_v2 .catalog = original_catalog
104
- if hasattr (original_catalog , ' _connection' ) and original_catalog ._connection is not None :
104
+ if hasattr (original_catalog , " _connection" ) and original_catalog ._connection is not None :
105
105
try :
106
106
original_catalog ._connection .close ()
107
107
except Exception :
@@ -336,7 +336,7 @@ def test_expire_snapshots_by_ids(table_v2: Table) -> None:
336
336
finally :
337
337
# Restore original catalog and cleanup any connections
338
338
table_v2 .catalog = original_catalog
339
- if hasattr (original_catalog , ' _connection' ) and original_catalog ._connection is not None :
339
+ if hasattr (original_catalog , " _connection" ) and original_catalog ._connection is not None :
340
340
try :
341
341
original_catalog ._connection .close ()
342
342
except Exception :
@@ -354,13 +354,13 @@ def test_expire_snapshots_with_table_property_defaults(table_v2: Table) -> None:
354
354
(5 , 5000 ), # Should be kept (newer than max age)
355
355
]
356
356
snapshots = _make_snapshots (ids_and_ts )
357
-
357
+
358
358
# Set table properties
359
359
properties = {
360
360
"history.expire.max-snapshot-age-ms" : "4500" , # Keep snapshots newer than this
361
- "history.expire.min-snapshots-to-keep" : "3" , # Always keep at least 3 snapshots
361
+ "history.expire.min-snapshots-to-keep" : "3" , # Always keep at least 3 snapshots
362
362
}
363
-
363
+
364
364
table_v2 .metadata = table_v2 .metadata .model_copy (
365
365
update = {
366
366
"snapshots" : snapshots ,
@@ -399,13 +399,13 @@ def test_explicit_parameters_override_table_properties(table_v2: Table) -> None:
399
399
(5 , 5000 ), # Will be kept (min snapshots)
400
400
]
401
401
snapshots = _make_snapshots (ids_and_ts )
402
-
402
+
403
403
# Set table properties that are more aggressive than what we'll use
404
404
properties = {
405
405
"history.expire.max-snapshot-age-ms" : "1500" , # Would expire more snapshots
406
- "history.expire.min-snapshots-to-keep" : "2" , # Would keep fewer snapshots
406
+ "history.expire.min-snapshots-to-keep" : "2" , # Would keep fewer snapshots
407
407
}
408
-
408
+
409
409
table_v2 .metadata = table_v2 .metadata .model_copy (
410
410
update = {
411
411
"snapshots" : snapshots ,
@@ -427,7 +427,7 @@ def test_explicit_parameters_override_table_properties(table_v2: Table) -> None:
427
427
# Call expire with explicit parameters that should override the properties
428
428
table_v2 .maintenance .expire_snapshots_with_retention_policy (
429
429
timestamp_ms = 1500 , # Only expire snapshots older than this
430
- min_snapshots_to_keep = 4 # Keep at least 4 snapshots (overrides property of 2)
430
+ min_snapshots_to_keep = 4 , # Keep at least 4 snapshots (overrides property of 2)
431
431
)
432
432
433
433
table_v2 .catalog .commit_table .assert_called_once ()
@@ -447,7 +447,7 @@ def test_expire_snapshots_no_properties_no_parameters(table_v2: Table) -> None:
447
447
(5 , 5000 ),
448
448
]
449
449
snapshots = _make_snapshots (ids_and_ts )
450
-
450
+
451
451
table_v2 .metadata = table_v2 .metadata .model_copy (
452
452
update = {
453
453
"snapshots" : snapshots ,
0 commit comments