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

Method test_readchunk

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

Source from the content-addressed store, hash-verified

640 self.assertEqual(in_data, out_data)
641
642 def test_readchunk(self):
643 in_data = b"a" * 10
644 f = GridIn(self.db.fs, chunkSize=3)
645 f.write(in_data)
646 f.close()
647
648 g = GridOut(self.db.fs, f._id)
649 self.assertEqual(3, len(g.readchunk()))
650
651 self.assertEqual(2, len(g.read(2)))
652 self.assertEqual(1, len(g.readchunk()))
653
654 self.assertEqual(3, len(g.read(3)))
655
656 self.assertEqual(1, len(g.readchunk()))
657
658 self.assertEqual(0, len(g.readchunk()))
659
660 def test_write_unicode(self):
661 f = GridIn(self.db.fs)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected