def setUp(self): self.test_taffmat_directory = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'test_taffmat_files') # Read in the TAFFmat file under test self.input_base_filename = os.path.join( self.test_taffmat_directory, 'UTEST001') self.data_array, self.time_vector, self.header_data = \ taffmat.read_taffmat(self.input_base_filename) # Setup the output_basefilename self.output_base_filename = os.path.join( self.test_taffmat_directory, 'test_output_taffmat') # Write the .dat and .hdr files using taffmat.py taffmat.write_taffmat( self.data_array, self.header_data, self.output_base_filename)
def test_writing_different_dataset_filename(self): new_output_base_filename = 'something_different' taffmat.write_taffmat(self.data_array, self.header_data, new_output_base_filename) data_array, time_vector, header_data = taffmat.read_taffmat( new_output_base_filename) self.assertEqual(header_data['dataset'], new_output_base_filename.upper()) new_output_dat, new_output_hdr = \ self._get_dat_hdr_filenames_from_base(new_output_base_filename) try: os.remove(new_output_dat) except: print("Couldn't remove the test dat file.") try: os.remove(new_output_hdr) except: print("Couldn't remove the test hdr file.")