def test_value_errors(self):
    dataset_fn = (lambda split, shuffle_files: tf.data.Dataset.from_tensors(['test']))
    output_features = {'inputs': dataset_providers.Feature(test_utils.sentencepiece_vocab())}
    with self.assertRaisesWithLiteralMatch(ValueError, "`CacheDatasetPlaceholder` can appear at most once in the preprocessing pipeline. Found 2 in 'multiple_cache_placeholders'."):
        dataset_providers.Task('multiple_cache_placeholders', source=dataset_providers.FunctionDataSource(dataset_fn=dataset_fn, splits=['train', 'validation']), preprocessors=[test_utils.test_text_preprocessor, preprocessors.tokenize, dataset_providers.CacheDatasetPlaceholder(), test_utils.test_token_preprocessor, dataset_providers.CacheDatasetPlaceholder()], output_features=output_features, metric_fns=[])
    with self.assertRaisesWithLiteralMatch(ValueError, "'test_token_preprocessor' has a `sequence_length` argument but occurs before `CacheDatasetPlaceholder` in 'sequence_length_pre_cache'. This is not allowed since the sequence length is specified at run time."):
        dataset_providers.Task('sequence_length_pre_cache', dataset_providers.FunctionDataSource(dataset_fn=dataset_fn, splits=['train']), preprocessors=[test_utils.test_text_preprocessor, preprocessors.tokenize, test_utils.test_token_preprocessor, dataset_providers.CacheDatasetPlaceholder()], output_features=output_features, metric_fns=[])
def test_value_errors(self):
    dataset_fn = (lambda split, shuffle_files: tf.data.Dataset.from_tensors(['test']))
    output_features = {'inputs': dataset_providers.Feature(test_utils.sentencepiece_vocab())}
    with self.assertRaisesWithLiteralMatch(ValueError, "`CacheDatasetPlaceholder` can appear at most once in the preprocessing pipeline. Found 2 in 'multiple_cache_placeholders'."):
        dataset_providers.Task('multiple_cache_placeholders', source=dataset_providers.FunctionDataSource(dataset_fn=dataset_fn, splits=['train', 'validation']), preprocessors=[test_utils.test_text_preprocessor, preprocessors.tokenize, dataset_providers.CacheDatasetPlaceholder(), test_utils.test_token_preprocessor, dataset_providers.CacheDatasetPlaceholder()], output_features=output_features, metric_fns=[])
    with self.assertRaisesWithLiteralMatch(ValueError, "'test_token_preprocessor' has a `sequence_length` argument but occurs before `CacheDatasetPlaceholder` in 'sequence_length_pre_cache'. This is not allowed since the sequence length is specified at run time."):
        dataset_providers.Task('sequence_length_pre_cache', dataset_providers.FunctionDataSource(dataset_fn=dataset_fn, splits=['train']), preprocessors=[test_utils.test_text_preprocessor, preprocessors.tokenize, test_utils.test_token_preprocessor, dataset_providers.CacheDatasetPlaceholder()], output_features=output_features, metric_fns=[])