def test_adapt_bad_input_fails(self):
    'Test that non-Dataset/Numpy inputs cause a reasonable error.'
    input_dataset = {'foo': 0}
    layer = AddingPreprocessingLayer()
    if tf.executing_eagerly():
        with self.assertRaisesRegex(ValueError, 'Failed to find data adapter'):
            layer.adapt(input_dataset)
    else:
        with self.assertRaisesRegex(ValueError, 'requires a'):
            layer.adapt(input_dataset)
Test that non-Dataset/Numpy inputs cause a reasonable error.
def test_adapt_bad_input_fails(self):
    
    input_dataset = {'foo': 0}
    layer = AddingPreprocessingLayer()
    if tf.executing_eagerly():
        with self.assertRaisesRegex(ValueError, 'Failed to find data adapter'):
            layer.adapt(input_dataset)
    else:
        with self.assertRaisesRegex(ValueError, 'requires a'):
            layer.adapt(input_dataset)