From d3fd5831c41305ff70f5058f15b1dc802bfe80e7 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 23 Apr 2024 18:50:09 +0300 Subject: [PATCH] Update tests to use the new delete_fragments API. --- tiledb/tests/test_fragments.py | 26 ++++++++++++-------------- tiledb/tests/test_libtiledb.py | 6 ++---- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/tiledb/tests/test_fragments.py b/tiledb/tests/test_fragments.py index 05439d7824..87dccb7524 100644 --- a/tiledb/tests/test_fragments.py +++ b/tiledb/tests/test_fragments.py @@ -704,13 +704,12 @@ def write_fragments(target_path, dshape, num_writes): if use_timestamps: assert frags.timestamp_range == ts - with tiledb.open(path, "m") as A: - if use_timestamps: - A.delete_fragments(3, 6) - else: - A.delete_fragments( - frags.timestamp_range[2][0], frags.timestamp_range[5][1] - ) + if use_timestamps: + tiledb.Array.delete_fragments(path, 3, 6) + else: + tiledb.Array.delete_fragments( + path, frags.timestamp_range[2][0], frags.timestamp_range[5][1] + ) frags = tiledb.array_fragments(path) assert len(frags) == 6 @@ -755,13 +754,12 @@ def test_delete_fragments_with_schema_evolution(self, use_timestamps): assert_array_equal(A[:]["a1"], ts2_data) assert_array_equal(A[:]["a2"], ts2_data) - with tiledb.open(path, "m") as A: - if use_timestamps: - A.delete_fragments(2, 2) - else: - A.delete_fragments( - frags.timestamp_range[1][0], frags.timestamp_range[1][1] - ) + if use_timestamps: + tiledb.Array.delete_fragments(path, 2, 2) + else: + tiledb.Array.delete_fragments( + path, frags.timestamp_range[1][0], frags.timestamp_range[1][1] + ) frags = tiledb.array_fragments(path) assert len(frags) == 1 diff --git a/tiledb/tests/test_libtiledb.py b/tiledb/tests/test_libtiledb.py index b9797aadaa..05fe9bf59a 100644 --- a/tiledb/tests/test_libtiledb.py +++ b/tiledb/tests/test_libtiledb.py @@ -367,12 +367,10 @@ def write_fragments(target_path, dshape, num_writes): assert frags.timestamp_range == ts if use_timestamps: - with tiledb.open(path, "m") as arr: - arr.delete_fragments(3, 6) + tiledb.Array.delete_fragments(path, 3, 6) else: timestamps = [t[0] for t in tiledb.array_fragments(path).timestamp_range] - with tiledb.open(path, "m") as arr: - arr.delete_fragments(timestamps[2], timestamps[5]) + tiledb.Array.delete_fragments(path, timestamps[2], timestamps[5]) frags = tiledb.array_fragments(path) assert len(frags) == 6