message: TF Keras io_utils_test missing test cases add
  1-test case added for ask_to_proceed_with_overwrite
diff: @@ -25,6 +25,7 @@ import numpy as np
  import six
  from tensorflow.python import keras
  +from tensorflow.python.keras.utils import io_utils
  from tensorflow.python.platform import test
  try:
  @@ -60,16 +61,12 @@ class TestIOUtils(test.TestCase):
  # Instantiating HDF5Matrix for the training set,
  # which is a slice of the first 150 elements
  - x_train = keras.utils.io_utils.HDF5Matrix(
  - h5_path, 'my_data', start=0, end=150)
  - y_train = keras.utils.io_utils.HDF5Matrix(
  - h5_path, 'my_labels', start=0, end=150)
  + x_train = io_utils.HDF5Matrix(h5_path, 'my_data', start=0, end=150)
  + y_train = io_utils.HDF5Matrix(h5_path, 'my_labels', start=0, end=150)
  # Likewise for the test set
  - x_test = keras.utils.io_utils.HDF5Matrix(
  - h5_path, 'my_data', start=150, end=200)
  - y_test = keras.utils.io_utils.HDF5Matrix(
  - h5_path, 'my_labels', start=150, end=200)
  + x_test = io_utils.HDF5Matrix(h5_path, 'my_data', start=150, end=200)
  + y_test = io_utils.HDF5Matrix(h5_path, 'my_labels', start=150, end=200)
  # HDF5Matrix behave more or less like Numpy matrices
  # with regard to indexing
  @@ -115,10 +112,26 @@ class TestIOUtils(test.TestCase):
  # test normalizer
  normalizer = lambda x: x + 1
  - normalized_x_train = keras.utils.io_utils.HDF5Matrix(
  + normalized_x_train = io_utils.HDF5Matrix(
  h5_path, 'my_data', start=0, end=150, normalizer=normalizer)
  self.assertAllClose(normalized_x_train[0][0], x_train[0][0] + 1)
  + def test_ask_to_proceed_with_overwrite(self):
  + with test.mock.patch('six.moves.input') as mock_log:
  + mock_log.return_value = 'y'
  + self.assertTrue(io_utils.ask_to_proceed_with_overwrite('/tmp/not_exists'))
  +
  + mock_log.return_value = 'n'
  + self.assertFalse(
  + io_utils.ask_to_proceed_with_overwrite('/tmp/not_exists'))
  +
  + mock_log.side_effect = ['m', 'y']
  + self.assertTrue(io_utils.ask_to_proceed_with_overwrite('/tmp/not_exists'))
  +
  + mock_log.side_effect = ['m', 'n']
  + self.assertFalse(
  + io_utils.ask_to_proceed_with_overwrite('/tmp/not_exists'))
  +
  if __name__ == '__main__':
  test.main()
  