예제 #1
0
 def test_from_gzip_file(self):
     source = CharSource.from_gzipped_file(
         Path(__file__).parent / "gzip_char_source_test.txt.gz")
     self.assertEqual("Hello\nworld\n", source.read_all())
     self.assertEqual(["Hello", "world"], source.readlines())
     with source.open() as inp:
         self.assertEqual("Hello\n", inp.readline())
         self.assertEqual("world\n", inp.readline())
예제 #2
0
 def test_empty_gzip(self):
     source = CharSource.from_gzipped_file(
         Path(__file__).parent / "empty_gzip.txt.gz")
     self.assertTrue(source.is_empty())
     self.assertEqual("", source.read_all())