예제 #1
0
 def test_text_file(self):
     url = "https://docs.python.org/3/library/io.html#module-io"
     name = "text.htm"
     f = SeekableHTTPFile(url, name, debug=True)
     f.seek(-200, io.SEEK_END)
     pos = f.tell()
     self.assertEqual(pos, f.content_length - 200)
     text = f.read(50)
     self.assertIsInstance(text, bytes)
     self.assertEqual(len(text), 50)
     self.assertEqual(name, f.name)
예제 #2
0
 def test_text_file(self):
     url = "https://docs.python.org/3/library/io.html#module-io"
     name = "text.htm"
     f = SeekableHTTPFile(url, name, debug=True)
     f.seek(-200, io.SEEK_END)
     pos = f.tell()
     self.assertEqual(pos, f.content_length - 200)
     text = f.read(50)
     self.assertIsInstance(text, bytes)
     self.assertEqual(len(text), 50)
     self.assertEqual(name, f.name)