MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_alive

Method test_alive

test/test_cursor.py:1268–1281  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1266 self.assertRaises(InvalidOperation, cursor.comment, "hello")
1267
1268 def test_alive(self):
1269 self.db.test.delete_many({})
1270 self.db.test.insert_many([{} for _ in range(3)])
1271 self.addCleanup(self.db.test.delete_many, {})
1272 cursor = self.db.test.find().batch_size(2)
1273 n = 0
1274 while True:
1275 cursor.next()
1276 n += 1
1277 if n == 3:
1278 self.assertFalse(cursor.alive)
1279 break
1280
1281 self.assertTrue(cursor.alive)
1282
1283 def test_close_kills_cursor_synchronously(self):
1284 # Kill any cursors possibly queued up by previous tests.

Callers

nothing calls this directly

Calls 6

addCleanupMethod · 0.80
delete_manyMethod · 0.45
insert_manyMethod · 0.45
batch_sizeMethod · 0.45
findMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected