dataset.freeze should not close provided fileobj

Test and solution for issue pudo/dataset#147
This commit is contained in:
Paul Morelle
2016-01-18 05:11:24 +01:00
parent dc3c14321a
commit 18bd08c009
3 changed files with 13 additions and 2 deletions
+9
View File
@@ -62,6 +62,15 @@ class FreezeTestCase(unittest.TestCase):
finally:
fh.close()
def test_memory_streams(self):
import io
for fmt in ('csv', 'json', 'tabson'):
with io.StringIO() as fd:
freeze(self.tbl.all(), format=fmt, fileobj=fd)
self.assertFalse(fd.closed, 'fileobj was closed for format %s' % fmt)
fd.getvalue() # should not throw
class SerializerTestCase(unittest.TestCase):