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())
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())