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

Method test_write_unicode

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

Source from the content-addressed store, hash-verified

658 self.assertEqual(0, len(g.readchunk()))
659
660 def test_write_unicode(self):
661 f = GridIn(self.db.fs)
662 with self.assertRaises(TypeError):
663 f.write("foo")
664
665 f = GridIn(self.db.fs, encoding="utf-8")
666 f.write("foo")
667 f.close()
668
669 g = GridOut(self.db.fs, f._id)
670 self.assertEqual(b"foo", g.read())
671
672 f = GridIn(self.db.fs, encoding="iso-8859-1")
673 f.write("aé")
674 f.close()
675
676 g = GridOut(self.db.fs, f._id)
677 self.assertEqual("aé".encode("iso-8859-1"), g.read())
678
679 def test_set_after_close(self):
680 f = GridIn(self.db.fs, _id="foo", bar="baz")

Callers

nothing calls this directly

Calls 6

writeMethod · 0.95
closeMethod · 0.95
readMethod · 0.95
GridInClass · 0.90
GridOutClass · 0.90
encodeMethod · 0.80

Tested by

no test coverage detected