Exemplo n.º 1
0
  def test_fileobj_copy_partial(self):
    inobj = io.BytesIO('adatab')
    outobj = io.BytesIO()
    inobj.read(1)

    isolateserver.fileobj_copy(outobj, inobj, size=4)
    self.assertEqual('data', outobj.getvalue())
Exemplo n.º 2
0
  def test_fileobj_copy_partial_file_no_size(self):
    with self.assertRaises(IOError):
      inobj = io.BytesIO('hello')
      outobj = io.BytesIO()

      inobj.read(1)
      isolateserver.fileobj_copy(outobj, inobj)
Exemplo n.º 3
0
  def test_fileobj_copy_size_but_file_short(self):
    with self.assertRaises(IOError):
      inobj = io.BytesIO('hello')
      outobj = io.BytesIO()

      isolateserver.fileobj_copy(outobj, inobj, size=10)
Exemplo n.º 4
0
  def test_fileobj_copy_simple(self):
    inobj = io.BytesIO('hello')
    outobj = io.BytesIO()

    isolateserver.fileobj_copy(outobj, inobj)
    self.assertEqual('hello', outobj.getvalue())