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

Method test_validate_collection

test/test_database.py:357–377  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

355 db_wc.drop_collection("test")
356
357 def test_validate_collection(self):
358 db = self.client.pymongo_test
359
360 with self.assertRaises(TypeError):
361 db.validate_collection(5) # type: ignore[arg-type]
362 with self.assertRaises(TypeError):
363 db.validate_collection(None) # type: ignore[arg-type]
364
365 db.test.insert_one({"dummy": "object"})
366
367 with self.assertRaises(OperationFailure):
368 db.validate_collection("test.doesnotexist")
369 with self.assertRaises(OperationFailure):
370 db.validate_collection(db.test.doesnotexist)
371
372 self.assertTrue(db.validate_collection("test"))
373 self.assertTrue(db.validate_collection(db.test))
374 self.assertTrue(db.validate_collection(db.test, full=True))
375 self.assertTrue(db.validate_collection(db.test, scandata=True))
376 self.assertTrue(db.validate_collection(db.test, scandata=True, full=True))
377 self.assertTrue(db.validate_collection(db.test, True, True))
378
379 @client_context.require_version_min(4, 3, 3)
380 @client_context.require_no_standalone

Callers

nothing calls this directly

Calls 2

validate_collectionMethod · 0.45
insert_oneMethod · 0.45

Tested by

no test coverage detected