@@ -836,9 +836,7 @@ def test_open_with_timestamp(self, use_timestamps):
836
836
with tiledb .DenseArray (self .path ("foo" ), mode = "w" ) as T :
837
837
T [:] = A
838
838
839
- read1_timestamp = - 1
840
839
with tiledb .DenseArray (self .path ("foo" ), mode = "r" ) as T :
841
- read1_timestamp = T .timestamp_range
842
840
self .assertEqual (T [0 ], 0 )
843
841
self .assertEqual (T [1 ], 0 )
844
842
self .assertEqual (T [2 ], 0 )
@@ -849,41 +847,36 @@ def test_open_with_timestamp(self, use_timestamps):
849
847
with tiledb .DenseArray (self .path ("foo" ), mode = "w" ) as T :
850
848
T [0 :1 ] = 1
851
849
852
- read2_timestamp = - 1
853
- with tiledb .DenseArray (self .path ("foo" ), mode = "r" ) as T :
854
- read2_timestamp = T .timestamp_range
855
- self .assertTrue (read2_timestamp > read1_timestamp )
856
-
857
850
if use_timestamps :
858
851
# sleep 200ms and write
859
852
time .sleep (0.2 )
860
853
with tiledb .DenseArray (self .path ("foo" ), mode = "w" ) as T :
861
854
T [1 :2 ] = 2
862
855
863
- read3_timestamp = - 1
864
- with tiledb . DenseArray ( self . path ( "foo" ), mode = "r" ) as T :
865
- read3_timestamp = T . timestamp_range
866
- self . assertTrue ( read3_timestamp > read2_timestamp > read1_timestamp )
856
+ frags = tiledb . array_fragments ( self . path ( "foo" ))
857
+ # timestamps are in the form of (start, end) for each fragment, with start == end,
858
+ # as we are not dealing with consolidated fragments. Let's simply read from 0 to the end timestamp.
859
+ read_timestamps = [( 0 , frag . timestamp_range [ 1 ]) for frag in frags ]
867
860
868
861
# read at first timestamp
869
862
with tiledb .DenseArray (
870
- self .path ("foo" ), timestamp = read1_timestamp , mode = "r"
863
+ self .path ("foo" ), timestamp = read_timestamps [ 0 ] , mode = "r"
871
864
) as T :
872
865
self .assertEqual (T [0 ], 0 )
873
866
self .assertEqual (T [1 ], 0 )
874
867
self .assertEqual (T [2 ], 0 )
875
868
876
869
# read at second timestamp
877
870
with tiledb .DenseArray (
878
- self .path ("foo" ), timestamp = read2_timestamp , mode = "r"
871
+ self .path ("foo" ), timestamp = read_timestamps [ 1 ] , mode = "r"
879
872
) as T :
880
873
self .assertEqual (T [0 ], 1 )
881
874
self .assertEqual (T [1 ], 0 )
882
875
self .assertEqual (T [2 ], 0 )
883
876
884
877
# read at third timestamp
885
878
with tiledb .DenseArray (
886
- self .path ("foo" ), timestamp = read3_timestamp , mode = "r"
879
+ self .path ("foo" ), timestamp = read_timestamps [ 2 ] , mode = "r"
887
880
) as T :
888
881
self .assertEqual (T [0 ], 1 )
889
882
self .assertEqual (T [1 ], 2 )
0 commit comments