def test_rec_ct_long_stream(self): """ Read test data and pull out all particles from a file at once. """ in_file = open(os.path.join(RESOURCE_PATH, 'SBE37-IM_20141231_2014_12_31.hex'), 'r') parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) total_records = 99 particles = parser.get_records(total_records) self.assertEqual(len(particles), total_records) self.assert_particles(particles, 'SBE37-IM_20141231_2014_12_31.yml', RESOURCE_PATH) # confirm there are no more particles in this file particles2 = parser.get_records(5) self.assertEqual(len(particles2), 0) in_file.close() self.assertEqual(self.exception_callback_value, [])
def test_ct_real(self): """ Test with a real CT file rather than a generated one """ with open(os.path.join(RESOURCE_PATH, 'SBE37-IM_03710261_2013_07_25.hex'), 'r') as in_file: parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) particles = parser.get_records(482) self.assertEqual(len(particles), 482) self.assertEqual(self.exception_callback_value, [])
def test_rec_ct_long_stream(self): """ Read test data and pull out all particles from a file at once. """ in_file = open( os.path.join(RESOURCE_PATH, 'SBE37-IM_20141231_2014_12_31.hex'), 'r') parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) total_records = 99 particles = parser.get_records(total_records) self.assertEqual(len(particles), total_records) self.assert_particles(particles, 'SBE37-IM_20141231_2014_12_31.yml', RESOURCE_PATH) # confirm there are no more particles in this file particles2 = parser.get_records(5) self.assertEqual(len(particles2), 0) in_file.close() self.assertEqual(self.exception_callback_value, [])
def test_ct_real(self): """ Test with a real CT file rather than a generated one """ with open( os.path.join(RESOURCE_PATH, 'SBE37-IM_03710261_2013_07_25.hex'), 'r') as in_file: parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) particles = parser.get_records(482) self.assertEqual(len(particles), 482) self.assertEqual(self.exception_callback_value, [])
def test_rec_ct_simple(self): """ Read Recovered CT data from the file and pull out data particles one at a time. Verify that the results are those we expected. """ with open(os.path.join(RESOURCE_PATH, 'SBE37-IM_20110101_2011_01_01.hex'), 'r') as in_file: parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) particles = parser.get_records(3) self.assertEqual(len(particles), 3) self.assert_particles(particles, 'SBE37-IM_20110101_2011_01_01.yml', RESOURCE_PATH) self.assertEqual(self.exception_callback_value, [])
def test_rec_ct_no_records(self): """ Read a Recovered CT data file that has no CT records. Verify that no particles are generated. """ in_file = open(os.path.join(RESOURCE_PATH, 'SBE37-IM_20100000_2010_00_00.hex'), 'r') parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) # Not expecting any particles. expected_results = [] # Try to get one particle and verify we didn't get any. result = parser.get_records(1) self.assertEqual(result, expected_results) in_file.close() self.assertEqual(self.exception_callback_value, [])
def test_rec_ct_no_records(self): """ Read a Recovered CT data file that has no CT records. Verify that no particles are generated. """ in_file = open( os.path.join(RESOURCE_PATH, 'SBE37-IM_20100000_2010_00_00.hex'), 'r') parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) # Not expecting any particles. expected_results = [] # Try to get one particle and verify we didn't get any. result = parser.get_records(1) self.assertEqual(result, expected_results) in_file.close() self.assertEqual(self.exception_callback_value, [])
def test_rec_ct_simple(self): """ Read Recovered CT data from the file and pull out data particles one at a time. Verify that the results are those we expected. """ with open( os.path.join(RESOURCE_PATH, 'SBE37-IM_20110101_2011_01_01.hex'), 'r') as in_file: parser = CtdmoGhqrRecoveredCtParser(self.config_rec_ct, in_file, self.exception_callback) particles = parser.get_records(3) self.assertEqual(len(particles), 3) self.assert_particles(particles, 'SBE37-IM_20110101_2011_01_01.yml', RESOURCE_PATH) self.assertEqual(self.exception_callback_value, [])