PYTHON-621: Fixed GridOut.read(0) returning string in Python 3

This commit is contained in:
Kyle Erf 2014-01-06 15:25:04 -08:00
parent 4142442c73
commit 464941e5ad
2 changed files with 4 additions and 1 deletions

View File

@ -467,7 +467,7 @@ class GridOut(object):
self._ensure_file()
if size == 0:
return ""
return EMPTY
remainder = int(self.length) - self.__position
if size < 0 or size > remainder:

View File

@ -73,6 +73,9 @@ class TestGridFile(unittest.TestCase):
g = GridOut(self.db.fs, f._id)
self.assertEqual(b(""), g.read())
# test that reading 0 returns proper type
self.assertEqual(b(""), g.read(0))
def test_md5(self):
f = GridIn(self.db.fs)
f.write(b("hello world\n"))