Beispiel #1
0
 def test_read_all_from_avro_file_pattern(self):
   file_pattern = self._write_pattern(5)
   with TestPipeline() as p:
     assert_that(
         p \
         | Create([file_pattern]) \
         | avroio.ReadAllFromAvro(use_fastavro=self.use_fastavro),
         equal_to(self.RECORDS * 5))
Beispiel #2
0
 def test_read_all_from_avro_single_file(self):
   path = self._write_data()
   with TestPipeline() as p:
     assert_that(
         p \
         | Create([path]) \
         | avroio.ReadAllFromAvro(use_fastavro=self.use_fastavro),
         equal_to(self.RECORDS))
 def test_read_all_from_avro_many_single_files(self):
     path1 = self._write_data()
     path2 = self._write_data()
     path3 = self._write_data()
     with TestPipeline() as p:
         assert_that(
             p | Create([path1, path2, path3]) | avroio.ReadAllFromAvro(),
             equal_to(self.RECORDS * 3))
 def test_read_all_from_avro_many_file_patterns(self):
     file_pattern1 = self._write_pattern(5)
     file_pattern2 = self._write_pattern(2)
     file_pattern3 = self._write_pattern(3)
     with TestPipeline() as p:
         assert_that(
             p
             | Create([file_pattern1, file_pattern2, file_pattern3])
             | avroio.ReadAllFromAvro(), equal_to(self.RECORDS * 10))
Beispiel #5
0
 def test_read_all_from_avro_with_filename(self):
   file_pattern, file_paths = self._write_pattern(3, return_filenames=True)
   result = [(path, record) for path in file_paths for record in self.RECORDS]
   with TestPipeline() as p:
     assert_that(
         p \
         | Create([file_pattern]) \
         | avroio.ReadAllFromAvro(with_filename=True),
         equal_to(result))