MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_iteration

Method test_iteration

test/test_change_stream.py:300–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

298
299 @no_type_check
300 def test_iteration(self):
301 with self.change_stream(batch_size=2) as change_stream:
302 num_inserted = 10
303 self.watched_collection().insert_many([{} for _ in range(num_inserted)])
304 inserts_received = 0
305 for change in change_stream:
306 self.assertEqual(change["operationType"], "insert")
307 inserts_received += 1
308 if inserts_received == num_inserted:
309 break
310 self._test_invalidate_stops_iteration(change_stream)
311
312 @no_type_check
313 @client_context.require_sync

Callers

nothing calls this directly

Calls 4

change_streamMethod · 0.45
insert_manyMethod · 0.45
watched_collectionMethod · 0.45

Tested by

no test coverage detected