old_contents: # Copyright 2017 The Chenmich Authors. All Rights Reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  # ==============================================================================
  import unittest
  import csv
  import large_data_preparation as ldp
  ''' Test large-data-preparation module
  '''
  class test_make_example(unittest.TestCase):
      ''' Test _make_example function in the large_data_preparation module
      '''
      def test_examples(self):
          ''' Test the examples generated by function _make_examples
          '''
          filename = 'data/raw_data/some00000.csv'
          with open(filename, mode='r', encoding='utf-8') as csvfile:
              reader = csv.reader(csvfile)
              lines = []
              for line in reader:
                  lines.append(line)
          sequence_length = 200
          length = len(lines)
          examples = ldp._make_examples(200, lines[sequence_length:])
          _num_example = len(lines[sequence_length:]) // (2*sequence_length) + 1
          length = len(examples)
          self.assertEqual(length, 2*_num_example)
          _tmp = examples[2*(_num_example - 1)]
          self.assertEqual(len(_tmp), sequence_length // 2)
          self.assertEqual(len(examples[2*_num_example - 1]), sequence_length //2)
  #
  class test_save_example(unittest.TestCase):
      ''' Test _save_examples function in the large_data_preparation module
          https://github.com/PyFilesystem/pyfilesystem
      '''
      
  if __name__ == "__main__":
      unittest.main()
  
new_contents: # Copyright 2017 The Chenmich Authors. All Rights Reserved.
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  # ==============================================================================
  import unittest
  import csv
  import numpy as np
  import large_data_preparation as ldp
  ''' Test large-data-preparation module
  '''
  class test_make_example(unittest.TestCase):
      ''' Test _make_example function in the large_data_preparation module
      '''
      def test_examples(self):
          ''' Test the examples generated by function _make_examples
          '''
          filename = 'data/raw_data/some00000.csv'
          lines = np.arange(20000).reshape(4000, 5)
          sequence_length = 200
          length = len(lines)
          examples = ldp._make_examples(200, lines[sequence_length:])
          _num_example = len(lines[sequence_length:]) // (2*sequence_length) + 1
          length = len(examples)
          self.assertEqual(length, 2*_num_example)
          _tmp = examples[2*(_num_example - 1)]
          self.assertEqual(len(_tmp), sequence_length // 2)
          self.assertEqual(len(examples[2*_num_example - 1]), sequence_length //2)
  #
  class test_save_example(unittest.TestCase):
      ''' Test _save_examples function in the large_data_preparation module
          https://github.com/PyFilesystem/pyfilesystem
      '''
      
  if __name__ == "__main__":
      unittest.main()
  
subject: modify test_examples function replace IO operation with Memory operation