示例#1
0
 def setUp(self):
     self.initial_range_start = 0
     self.initial_range_stop = 4
     self.initial_range_source = RangeSource(self.initial_range_start,
                                             self.initial_range_stop)
     self.sdf_restriction_provider = (
         iobase._SDFBoundedSourceRestrictionProvider(desired_chunk_size=2))
示例#2
0
 def test_concat_source_split(self):
   element = self.initial_range_source
   initial_concat_source = ConcatSource([self.initial_range_source])
   sdf_concat_restriction_provider = (
       iobase._SDFBoundedSourceRestrictionProvider(desired_chunk_size=2))
   restriction = (self.sdf_restriction_provider.initial_restriction(element))
   expect_splits = [(0, 2), (2, 4)]
   split_bundles = list(
       sdf_concat_restriction_provider.split(
           initial_concat_source, restriction))
   self.assertTrue(
       all(
           isinstance(bundle._source_bundle, SourceBundle)
           for bundle in split_bundles))
   splits = ([(
       bundle._source_bundle.start_position,
       bundle._source_bundle.stop_position) for bundle in split_bundles])
   self.assertEqual(expect_splits, list(splits))