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

Method test_missing_length_iter

test/test_gridfs_bucket.py:350–364  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

348 self.assertEqual(b"from stream with custom id", (self.fs.open_download_stream(oid)).read())
349
350 def test_missing_length_iter(self):
351 # Test fix that guards against PHP-237
352 self.fs.upload_from_stream("empty", b"")
353 doc = self.db.fs.files.find_one({"filename": "empty"})
354 assert doc is not None
355 doc.pop("length")
356 self.db.fs.files.replace_one({"_id": doc["_id"]}, doc)
357 fstr = self.fs.open_download_stream_by_name("empty")
358
359 def iterate_file(grid_file):
360 for _ in grid_file:
361 pass
362 return True
363
364 self.assertTrue(iterate_file(fstr))
365
366 def test_gridfs_lazy_connect(self):
367 client = self.single_client("badhost", connect=False, serverSelectionTimeoutMS=0)

Callers

nothing calls this directly

Calls 5

upload_from_streamMethod · 0.45
find_oneMethod · 0.45
popMethod · 0.45
replace_oneMethod · 0.45

Tested by

no test coverage detected