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

Method test_write_file_like

test/test_grid_file.py:348–368  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

346 four.name
347
348 def test_write_file_like(self):
349 one = GridIn(self.db.fs)
350 one.write(b"hello world")
351 one.close()
352
353 two = GridOut(self.db.fs, one._id)
354
355 three = GridIn(self.db.fs)
356 three.write(two)
357 three.close()
358
359 four = GridOut(self.db.fs, three._id)
360 self.assertEqual(b"hello world", four.read())
361
362 five = GridIn(self.db.fs, chunk_size=2)
363 five.write(b"hello")
364 buffer = BytesIO(b" world")
365 five.write(buffer)
366 five.write(b" and mongodb")
367 five.close()
368 self.assertEqual(b"hello world and mongodb", GridOut(self.db.fs, five._id).read())
369
370 def test_write_lines(self):
371 a = GridIn(self.db.fs)

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
closeMethod · 0.95
readMethod · 0.95
GridInClass · 0.90
GridOutClass · 0.90
readMethod · 0.45

Tested by

no test coverage detected