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):
15281528 error_object .get ("$err" ),
15291529 error_object .get ("code" ),
15301530 error_object )
1531- return [self .documents ]
1531+ if self .documents :
1532+ return [self .documents ]
1533+ return []
15321534
15331535 def unpack_response (self , cursor_id = None ,
15341536 codec_options = _UNICODE_REPLACE_CODEC_OPTIONS ,
Original file line number Diff line number Diff line change @@ -1483,7 +1483,14 @@ def test_explain(self):
14831483 explanation = c .find_raw_batches ().explain ()
14841484 self .assertIsInstance (explanation , dict )
14851485
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+
14861492 def test_clone (self ):
1493+ self .db .test .insert_one ({})
14871494 cursor = self .db .test .find_raw_batches ()
14881495 # Copy of a RawBatchCursor is also a RawBatchCursor, not a Cursor.
14891496 self .assertIsInstance (next (cursor .clone ()), bytes )
You can’t perform that action at this time.
0 commit comments