Exemple #1
0
 def test_seek_too_far_real_file(self):
     # StringIO doesn't raise IOError if you see past the start of the file.
     flo = tempfile.TemporaryFile()
     content = '1234567890'
     flo.write(content)
     self.assertEqual((content, 0), utils.last_bytes(flo, 1000))
Exemple #2
0
 def test_read_all(self):
     self.f.seek(0, os.SEEK_SET)
     out, remaining = utils.last_bytes(self.f, 1000)
     self.assertEqual(out, '1234567890')
     self.assertFalse(remaining > 0)
Exemple #3
0
 def test_truncated(self):
     self.f.seek(0, os.SEEK_SET)
     out, remaining = utils.last_bytes(self.f, 5)
     self.assertEqual(out, '67890')
     self.assertTrue(remaining > 0)
Exemple #4
0
 def test_seek_too_far_real_file(self):
     # StringIO doesn't raise IOError if you see past the start of the file.
     flo = tempfile.TemporaryFile()
     content = '1234567890'
     flo.write(content)
     self.assertEqual((content, 0), utils.last_bytes(flo, 1000))
Exemple #5
0
 def test_read_all(self):
     self.f.seek(0, os.SEEK_SET)
     out, remaining = utils.last_bytes(self.f, 1000)
     self.assertEqual(out, '1234567890')
     self.assertFalse(remaining > 0)
Exemple #6
0
 def test_truncated(self):
     self.f.seek(0, os.SEEK_SET)
     out, remaining = utils.last_bytes(self.f, 5)
     self.assertEqual(out, '67890')
     self.assertTrue(remaining > 0)