@@ -1338,23 +1338,23 @@ def assertCursorKilled():
1338
1338
1339
1339
1340
1340
class TestRawBSONCursor (IntegrationTest ):
1341
- def test_raw_batches (self ):
1341
+ def test_find_raw (self ):
1342
1342
c = self .db .test
1343
1343
c .drop ()
1344
1344
docs = [{'_id' : i , 'x' : 3.0 * i } for i in range (10 )]
1345
1345
c .insert_many (docs )
1346
- batches = list (c .find ( raw_batches = True ).sort ('_id' ))
1346
+ batches = list (c .find_raw ( ).sort ('_id' ))
1347
1347
self .assertEqual (1 , len (batches ))
1348
1348
self .assertEqual (docs , decode_all (batches [0 ]))
1349
1349
1350
1350
def test_explain (self ):
1351
1351
c = self .db .test
1352
1352
c .insert_one ({})
1353
- explanation = c .find ( raw_batches = True ).explain ()
1353
+ explanation = c .find_raw ( ).explain ()
1354
1354
self .assertIsInstance (explanation , dict )
1355
1355
1356
1356
def test_clone (self ):
1357
- cursor = self .db .test .find ( raw_batches = True )
1357
+ cursor = self .db .test .find_raw ( )
1358
1358
# Copy of a RawBSONCursor is also a RawBSONCursor, not a Cursor.
1359
1359
self .assertIsInstance (next (cursor .clone ()), bytes )
1360
1360
self .assertIsInstance (next (copy .copy (cursor )), bytes )
@@ -1364,42 +1364,39 @@ def test_exhaust(self):
1364
1364
c = self .db .test
1365
1365
c .drop ()
1366
1366
c .insert_many ({'_id' : i } for i in range (200 ))
1367
- result = b'' .join (
1368
- c .find (raw_batches = True , cursor_type = CursorType .EXHAUST ))
1369
-
1367
+ result = b'' .join (c .find_raw (cursor_type = CursorType .EXHAUST ))
1370
1368
self .assertEqual ([{'_id' : i } for i in range (200 )], decode_all (result ))
1371
1369
1372
1370
def test_server_error (self ):
1373
1371
with self .assertRaises (OperationFailure ) as exc :
1374
- next (self .db .test .find ({'x' : {'$bad' : 1 }}, raw_batches = True ))
1372
+ next (self .db .test .find_raw ({'x' : {'$bad' : 1 }}))
1375
1373
1376
1374
# The server response was decoded, not left raw.
1377
1375
self .assertIsInstance (exc .exception .details , dict )
1378
1376
1379
1377
def test_get_item (self ):
1380
1378
with self .assertRaises (InvalidOperation ):
1381
- self .db .test .find ( raw_batches = True )[0 ]
1379
+ self .db .test .find_raw ( )[0 ]
1382
1380
1383
1381
@client_context .require_version_min (3 , 4 )
1384
1382
def test_collation (self ):
1385
- next (self .db .test .find (collation = Collation ('en_US' ), raw_batches = True ))
1383
+ next (self .db .test .find_raw (collation = Collation ('en_US' )))
1386
1384
1387
1385
@client_context .require_version_max (3 , 2 )
1388
1386
def test_collation_error (self ):
1389
1387
with self .assertRaises (ConfigurationError ):
1390
- next (self .db .test .find (collation = Collation ('en_US' ),
1391
- raw_batches = True ))
1388
+ next (self .db .test .find_raw (collation = Collation ('en_US' )))
1392
1389
1393
1390
@client_context .require_version_min (3 , 2 )
1394
1391
def test_read_concern (self ):
1395
1392
c = self .db .get_collection ("test" , read_concern = ReadConcern ("majority" ))
1396
- next (c .find ( raw_batches = True ))
1393
+ next (c .find_raw ( ))
1397
1394
1398
1395
@client_context .require_version_max (3 , 1 )
1399
1396
def test_read_concern_error (self ):
1400
1397
c = self .db .get_collection ("test" , read_concern = ReadConcern ("majority" ))
1401
1398
with self .assertRaises (ConfigurationError ):
1402
- next (c .find ( raw_batches = True ))
1399
+ next (c .find_raw ( ))
1403
1400
1404
1401
def test_monitoring (self ):
1405
1402
listener = EventListener ()
@@ -1409,7 +1406,7 @@ def test_monitoring(self):
1409
1406
c .insert_many ([{'_id' : i } for i in range (10 )])
1410
1407
1411
1408
listener .results .clear ()
1412
- cursor = c .find ( raw_batches = True , batch_size = 4 )
1409
+ cursor = c .find_raw ( batch_size = 4 )
1413
1410
1414
1411
# First raw batch of 4 documents.
1415
1412
next (cursor )
0 commit comments