def test_flord(self): """ Read data from a file and pull out data particles one at a time. Verify that the results are those we expected. """ log.debug( '===== START TEST 3 SIMPLE: ATTACHED DOSTA INSTRUMENT RECOVERED DATA =====' ) # test the recovered path, current config with open(os.path.join(RESOURCE_PATH, 'ctdbp_p_test_1-3.hex'), 'rU') as file_handle: parser = CtdbpPCommonParser(FLORD_RECOV_CONFIG, file_handle, self.exception_callback) particles = parser.get_records(2) # Make sure we obtained 1 particle self.assertTrue(len(particles) == 2) # Make sure there were no errors self.assertEqual(self.exception_callback_value, []) self.assert_particles(particles, 'ctdbp_p_test_3.exp_results.yml', RESOURCE_PATH) log.debug( '===== END TEST 3 SIMPLE: ATTACHED DOSTA INSTRUMENT RECOVERED DATA =====' )
def test_no_particles(self): """ Verify that no particles are produced if the input file has no instrument records. """ log.debug('===== START TEST 6: NO PARTICLES =====') with open(os.path.join(RESOURCE_PATH, 'ctdbp_p_test_6.hex'), 'rU') as file_handle: parser = CtdbpPCommonParser(CTDBP_RECOV_CONFIG, file_handle, self.exception_callback) particles = parser.get_records(1) self.assertEquals(len(particles), 0) log.debug('===== END TEST 6: NO PARTICLES =====')
def test_invalid_value(self): """ The file used here has an invalid record with a non-hexadecimal character. """ log.debug('===== START TEST 5: INVALID VALUE =====') # check error handling on an uncorrected Endurance data file ( one record truncated ) with open(os.path.join(RESOURCE_PATH, 'ctdbp_p_test_5.hex'), 'rU') as file_handle: parser = CtdbpPCommonParser(CTDBP_RECOV_CONFIG, file_handle, self.exception_callback) particles = parser.get_records(2) self.assertEquals(len(particles), 1) self.assert_(isinstance(self.exception_callback_value[0], RecoverableSampleException)) log.debug('===== END TEST 5: INVALID VALUE =====')
def _build_parser(self, stream_handle): # The parser inherits from simple parser - other callbacks not needed here parser = CtdbpPCommonParser(DOSTA_RECOV_CONFIG, stream_handle, self._exception_callback) return parser
def test_flord(self): """ Read data from a file and pull out data particles one at a time. Verify that the results are those we expected. """ log.debug('===== START TEST 3 SIMPLE: ATTACHED DOSTA INSTRUMENT RECOVERED DATA =====') # test the recovered path, current config with open(os.path.join(RESOURCE_PATH, 'ctdbp_p_test_1-3.hex'), 'rU') as file_handle: parser = CtdbpPCommonParser(FLORD_RECOV_CONFIG, file_handle, self.exception_callback) particles = parser.get_records(2) # Make sure we obtained 1 particle self.assertTrue(len(particles) == 2) # Make sure there were no errors self.assertEqual(self.exception_callback_value, []) self.assert_particles(particles, 'ctdbp_p_test_3.exp_results.yml', RESOURCE_PATH) log.debug('===== END TEST 3 SIMPLE: ATTACHED DOSTA INSTRUMENT RECOVERED DATA =====')
def test_invalid_value(self): """ The file used here has an invalid record with a non-hexadecimal character. """ log.debug('===== START TEST 5: INVALID VALUE =====') # check error handling on an uncorrected Endurance data file ( one record truncated ) with open(os.path.join(RESOURCE_PATH, 'ctdbp_p_test_5.hex'), 'rU') as file_handle: parser = CtdbpPCommonParser(CTDBP_RECOV_CONFIG, file_handle, self.exception_callback) particles = parser.get_records(2) self.assertEquals(len(particles), 1) self.assert_( isinstance(self.exception_callback_value[0], RecoverableSampleException)) log.debug('===== END TEST 5: INVALID VALUE =====')