1
1
import pytest
2
- from packaging import version
3
2
4
3
from arango .exceptions import (
5
4
CursorCloseError ,
@@ -263,7 +262,7 @@ def test_cursor_manual_fetch_and_pop(db, col, docs):
263
262
assert err .value .message == "current batch is empty"
264
263
265
264
266
- def test_cursor_retry_disabled (db , col , docs , db_version ):
265
+ def test_cursor_retry_disabled (db , col , docs ):
267
266
cursor = db .aql .execute (
268
267
f"FOR d IN { col .name } SORT d._key RETURN d" ,
269
268
count = True ,
@@ -282,8 +281,7 @@ def test_cursor_retry_disabled(db, col, docs, db_version):
282
281
# The next batch ID should have no effect
283
282
cursor ._next_batch_id = "2"
284
283
result = cursor .fetch ()
285
- if db_version >= version .parse ("3.11.1" ):
286
- assert result ["next_batch_id" ] == "4"
284
+ assert result ["next_batch_id" ] == "4"
287
285
doc = cursor .pop ()
288
286
assert clean_doc (doc ) == docs [2 ]
289
287
@@ -308,28 +306,25 @@ def test_cursor_retry(db, col, docs, db_version):
308
306
309
307
result = cursor .fetch ()
310
308
assert result ["id" ] == cursor .id
311
- if db_version >= version .parse ("3.11.0" ):
312
- assert result ["next_batch_id" ] == "3"
309
+ assert result ["next_batch_id" ] == "3"
313
310
doc = cursor .pop ()
314
311
assert clean_doc (doc ) == docs [1 ]
315
312
assert cursor .empty ()
316
313
317
314
# Decrease the next batch ID as if the previous fetch failed
318
- if db_version >= version .parse ("3.11.0" ):
319
- cursor ._next_batch_id = "2"
320
- result = cursor .fetch ()
321
- assert result ["id" ] == cursor .id
322
- assert result ["next_batch_id" ] == "3"
323
- doc = cursor .pop ()
324
- assert clean_doc (doc ) == docs [1 ]
325
- assert cursor .empty ()
315
+ cursor ._next_batch_id = "2"
316
+ result = cursor .fetch ()
317
+ assert result ["id" ] == cursor .id
318
+ assert result ["next_batch_id" ] == "3"
319
+ doc = cursor .pop ()
320
+ assert clean_doc (doc ) == docs [1 ]
321
+ assert cursor .empty ()
326
322
327
323
# Fetch the next batches normally
328
324
for batch in range (2 , 5 ):
329
325
result = cursor .fetch ()
330
326
assert result ["id" ] == cursor .id
331
- if db_version >= version .parse ("3.11.0" ):
332
- assert result ["next_batch_id" ] == str (batch + 2 )
327
+ assert result ["next_batch_id" ] == str (batch + 2 )
333
328
doc = cursor .pop ()
334
329
assert clean_doc (doc ) == docs [batch ]
335
330
@@ -340,17 +335,12 @@ def test_cursor_retry(db, col, docs, db_version):
340
335
doc = cursor .pop ()
341
336
assert clean_doc (doc ) == docs [- 1 ]
342
337
343
- if db_version >= version .parse ("3.11.0" ):
344
- # We should be able to fetch the last batch again
345
- cursor .fetch ()
346
- doc = cursor .pop ()
347
- assert clean_doc (doc ) == docs [- 1 ]
338
+ # We should be able to fetch the last batch again
339
+ cursor .fetch ()
340
+ doc = cursor .pop ()
341
+ assert clean_doc (doc ) == docs [- 1 ]
348
342
349
- if db_version >= version .parse ("3.11.0" ):
350
- assert cursor .close ()
351
- else :
352
- with pytest .raises (CursorCloseError ):
353
- cursor .close ()
343
+ assert cursor .close ()
354
344
355
345
356
346
def test_cursor_no_count (db , col ):
0 commit comments