File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1528,7 +1528,9 @@ def raw_response(self, cursor_id=None):
1528
1528
error_object .get ("$err" ),
1529
1529
error_object .get ("code" ),
1530
1530
error_object )
1531
- return [self .documents ]
1531
+ if self .documents :
1532
+ return [self .documents ]
1533
+ return []
1532
1534
1533
1535
def unpack_response (self , cursor_id = None ,
1534
1536
codec_options = _UNICODE_REPLACE_CODEC_OPTIONS ,
Original file line number Diff line number Diff line change @@ -1483,7 +1483,14 @@ def test_explain(self):
1483
1483
explanation = c .find_raw_batches ().explain ()
1484
1484
self .assertIsInstance (explanation , dict )
1485
1485
1486
+ def test_empty (self ):
1487
+ self .db .test .drop ()
1488
+ cursor = self .db .test .find_raw_batches ()
1489
+ with self .assertRaises (StopIteration ):
1490
+ next (cursor )
1491
+
1486
1492
def test_clone (self ):
1493
+ self .db .test .insert_one ({})
1487
1494
cursor = self .db .test .find_raw_batches ()
1488
1495
# Copy of a RawBatchCursor is also a RawBatchCursor, not a Cursor.
1489
1496
self .assertIsInstance (next (cursor .clone ()), bytes )
You can’t perform that action at this time.
0 commit comments