def __init__(self): # Set the valid results self.valid_results = True self.msg = OntologyIsSubsuperclass(parent_class='SpatialThing', child_class='Oven', recursive=True) self.svc = RappPlatformService(self.msg)
def __init__(self): self.msg = WeatherReportForecast() self.msg.req.city = 'Athens' self.msg.req.weather_reporter = '' self.msg.req.metric = 0 self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'multi_faces_frames', 'two_faces.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True, msg=self.msg) self.valid_numFaces = 2
def __init__(self): self.msg = EmailFetch( email='*****@*****.**', password='', server='imap.gmail.com', port='', date_from=0, date_to=100000000, email_status='', num_emails=1) self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.msg = NewsExplore(news_engine='', keywords=[], exclude_titles=[], region='', topic='', num_news=5) self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'klpanagi_medium_straight.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True, msg=self.msg) self.valid_faces = [{ 'up_left_point': {'y': 545.0, 'x': 720.0}, 'down_right_point': {'y': 672.0, 'x': 847.0} }]
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_sentence2.ogg') self.msg = SpeechRecognitionGoogle(language='en', audio_source='nao_ogg', audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = ['check', 'my', 'mail']
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'deutera.wav') self.msg = SpeechRecognitionSphinx(language='el', audio_source='headset', words=[u'Δευτέρα'], sentences=[u'Δευτέρα'], grammar=[u'Δευτέρα'], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'Δευτέρα']
def __init__(self): self.validResults = { 'city': 'San Francisco', 'zip': '94107', 'country': 'United States', 'region': 'California', 'country_code': 'US', 'longtitude': -122.39330291748047, 'latitude': 37.76969909667969, 'timezone': 'America/Los_Angeles', 'error': '' } self.msg = Geolocation(ipaddr='104.16.115.182') self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'thelw-voithia.wav') self.msg = SpeechRecognitionSphinx(language='el', audio_source='nao_wav_1_ch', words=[u'θέλω', u'βοήθεια'], sentences=[u'θέλω', u'βοήθεια'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'θέλω', u'βοήθεια']
class RappInterfaceTest: def __init__(self): # Set the valid results self.valid_results = True; self.msg = OntologyIsSubsuperclass( parent_class='SpatialThing', child_class='Oven', recursive=True) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() # Call the RappCloud service response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] # Get the returned data return_data = response.result # Check if the returned data are equal to the expected if self.valid_results == return_data: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(return_data), self.elapsed_time]
def __init__(self): self.msg = WeatherReportCurrent() self.msg.req.city = 'Athens' self.msg.req.weather_reporter = '' self.msg.req.metric = 0 self.svc = RappPlatformService(self.msg)
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') zipFile = join(pkgDir, 'test_data', 'zip_files', \ 'image_audio_sample.zip') self.msg = EmailSend( email='*****@*****.**', password='', server='smtp.gmail.com', port='587', recipients=['*****@*****.**', '*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test', attach_file=zipFile) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] else: return [True, self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'thelw-voithia.wav') self.msg = SpeechRecognitionSphinx(language='el', audio_source='nao_wav_1_ch', words=[u'θέλω', u'βοήθεια'], sentences=[u'θέλω', u'βοήθεια'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'θέλω', u'βοήθεια'] def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if self.valid_words_found == response.words: return [True, self.elapsed_time] else: return [ "Unexpected result : " + str(response.words), self.elapsed_time ]
class RappInterfaceTest: def __init__(self): self.msg = EmailFetch( email='*****@*****.**', password='', server='imap.gmail.com', port='', date_from=0, date_to=100000000, email_status='', num_emails=1) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] else: return [True, self.elapsed_time]
class RappInterfaceTest: def __init__(self): # Set the valid results self.valid_results = True self.msg = OntologyIsSubsuperclass(parent_class='SpatialThing', child_class='Oven', recursive=True) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() # Call the RappCloud service response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] # Get the returned data return_data = response.result # Check if the returned data are equal to the expected if self.valid_results == return_data: return [True, self.elapsed_time] else: return [ "Unexpected result : " + str(return_data), self.elapsed_time ]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.msg = NewsExplore(news_engine='', keywords=[], exclude_titles=[], region='', topic='', num_news=5) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if len(response.news_stories) == self.svc.num_news: return [True, self.elapsed_time] else: return ["Unexpected result : " + \ ' Number of news stories requested -> ' + \ str(self.svc.num_news) + ', received -> ' + \ str(len(response.news_stories)), self.elapsed_time]
class RappInterfaceTest: def __init__(self): self.validResults = { 'city': 'San Francisco', 'zip': '94107', 'country': 'United States', 'region': 'California', 'country_code': 'US', 'longtitude': -122.39330291748047, 'latitude': 37.76969909667969, 'timezone': 'America/Los_Angeles', 'error': '' } self.msg = Geolocation(ipaddr='104.16.115.182') self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() print response.serialize() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if self.validResults == response.serialize(): return [True, self.elapsed_time] else: return [error, self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.image = join(pkgDir, 'test_data', 'human_detection_samples', 'NAO_picture_3.png') self.valid_humans = [{ 'up_left_point': {'y': 30.0, 'x': 48.0}, 'down_right_point': {'y': 399.0, 'x': 232.0} }] self.msg = HumanDetection(imageFilepath=self.image) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] humans = response.humans if self.valid_humans == humans: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(response), self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_sentence2.ogg') self.msg = SpeechRecognitionGoogle(language='en', audio_source='nao_ogg', audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = ['check', 'my', 'mail'] def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] words_found = response.words alt_words_found = response.alternatives if self.valid_words_found == words_found or self.valid_words_found in alt_words_found: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(response), self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data','qr_samples', 'hardFarQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{'y': 580, 'x': 669}], 'qr_messages': ['This QR will be used to check the algorithmic robustness as it is quite small'], 'error': '' } def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if self.valid_results == response.serialize(): return [True, self.elapsed_time] else: return ["Unexpected result : " + str(return_data), self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'klpanagi_medium_straight.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True, msg=self.msg) self.valid_faces = [{ 'up_left_point': {'y': 545.0, 'x': 720.0}, 'down_right_point': {'y': 672.0, 'x': 847.0} }] def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] faces = response.faces if self.valid_faces == faces: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(response), self.elapsed_time]
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_yes.ogg') self.msg = SpeechRecognitionSphinx(language='en', audio_source='nao_ogg', words=[u'yes', u'no'], sentences=[u'yes', u'no'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'yes']
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'multi_faces_frames', 'two_faces.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True, msg=self.msg) self.valid_numFaces = 2 def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] numFaces = len(response.faces) if self.valid_numFaces == numFaces: return [True, self.elapsed_time] else: return ["Unexpected result : " + ' Number of faces found -> ' +\ str(numFaces) + ', expected -> ' + str(self.valid_numFaces), \ self.elapsed_time]
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.attach = join(pkgDir, 'test_data', 'Lenna.png') self.msg = EmailSend( email='*****@*****.**', password='', server='smtp.gmail.com', port='587', recipients=['*****@*****.**', '*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test', attach_file=self.attach) self.svc = RappPlatformService(self.msg)
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data','qr_samples', 'mediumMediumQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{'y': 535, 'x': 680}], 'qr_messages': ['This is NAO from Greece'], 'error': '' } def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if self.valid_results == response.serialize(): return [True, self.elapsed_time] else: return ["Unexpected result : " + str(return_data), self.elapsed_time]
class EmailSendTests(unittest.TestCase): def setUp(self): self.svc = RappPlatformService() self.pkgDir = rospkg.RosPack().get_path('rapp_testing_tools') def test_single_attachment(self): attach = join(self.pkgDir, 'test_data', 'Lenna.png') msg = EmailSend(email='*****@*****.**', password='******', server='smtp.gmail.com', port='587', recipients=['*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test', attach_file=attach) resp = self.svc.call(msg) self.assertEqual(resp.error, u'') def test_no_attachment(self): msg = EmailSend(email='*****@*****.**', password='', server='smtp.gmail.com', port='587', recipients=['*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test') resp = self.svc.call(msg) self.assertEqual(resp.error, u'') def test_multiple_files_zip(self): attach = join(self.pkgDir, 'test_data', 'zip_files', 'image_audio_sample.zip') msg = EmailSend(email='*****@*****.**', password='', server='smtp.gmail.com', port='587', recipients=['*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test', attach_file=attach) resp = self.svc.call(msg) self.assertEqual(resp.error, u'')
def __init__(self): # Set the valid results self.valid_results = True; self.msg = OntologyIsSubsuperclass( parent_class='SpatialThing', child_class='Oven', recursive=True) self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'qr_samples', 'mediumFarQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{ 'y': 585, 'x': 690 }], 'qr_messages': ['This is NAO from Greece'], 'error': '' }
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'qr_samples', 'easyNearQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{ 'y': 510, 'x': 636 }], 'qr_messages': ['Hello there'], 'error': '' }
def test_call_response(self): self.svc = Service(msg=self.msg) self.blockPrint() _resp = self.svc.call(self.msg) self.enablePrint() self.assertIsInstance(_resp, FaceDetection.Response) self.assertIsInstance(_resp.faces, list) self.assertIsInstance(_resp.error, basestring)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.image = join(pkgDir, 'test_data', 'human_detection_samples', 'NAO_picture_3.png') self.valid_humans = [{ 'up_left_point': { 'y': 30.0, 'x': 48.0 }, 'down_right_point': { 'y': 399.0, 'x': 232.0 } }] self.msg = HumanDetection(imageFilepath=self.image) self.svc = RappPlatformService(self.msg)
def test_call_multi(self): self.svc = Service(msg=self.msg) self.blockPrint() _resp = self.svc.call(self.msg) for _ in range(10): _respTemp = self.svc.call(self.msg) self.assertEqual(_resp, _respTemp) _resp = _respTemp self.enablePrint()
class AsyncCallsTest(unittest.TestCase): def blockPrint(self): sys.stdout = NullDevice() sys.stderr = NullDevice() def enablePrint(self): sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ def setUp(self): self.startTime = time.time() self.msg = FaceDetection() self.msg.req.imageFilepath = path.join(testdatadir, 'Lenna.png') self.msg.req.fast = False self.svc = Service(msg=self.msg, persistent=True, timeout=15000) def tearDown(self): t = time.time() - self.startTime print "%s: %.3f" % (self.id(), t) def test_simple(self): sh = self.svc.call_async(self.msg, self.clb1) sh.wait() def test_wait(self): sh = self.svc.call_async(self.msg, self.clb1) resp = sh.wait() self.assertIsInstance(resp, FaceDetection.Response) def test_wait_no_callback(self): sh = self.svc.call_async(self.msg) resp = sh.wait() self.assertIsInstance(resp, FaceDetection.Response) def test_async_multi_calls_x2(self): n = 2 asyncH = [] for i in range(0, n): asyncH.append(self.svc.call_async(self.msg, self.clb1)) for h in asyncH: h.wait() def clb1(self, resp): self.assertIsInstance(resp, FaceDetection.Response)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'etsardou_far_angle.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True) self.valid_faces = [{ 'up_left_point': { 'y': 394.0, 'x': 726.0 }, 'down_right_point': { 'y': 510.0, 'x': 842.0 } }]
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'qr_samples', 'hardNearQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{ 'y': 552, 'x': 645 }], 'qr_messages': [ 'This QR will be used to check the algorithmic robustness as it is quite small' ], 'error': '' }
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.image = join(pkgDir, 'test_data', 'human_detection_samples', 'NAO_picture_3.png') self.valid_humans = [{ 'up_left_point': {'y': 30.0, 'x': 48.0}, 'down_right_point': {'y': 399.0, 'x': 232.0} }] self.msg = HumanDetection(imageFilepath=self.image) self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data','qr_samples', 'easyNearQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{'y': 510, 'x': 636}], 'qr_messages': ['Hello there'], 'error': '' }
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data','qr_samples', 'mediumMediumQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{'y': 535, 'x': 680}], 'qr_messages': ['This is NAO from Greece'], 'error': '' }
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data', 'face_samples', 'etsardou_close_angle.jpg') self.msg = FaceDetection(imageFilepath=imagepath, fast=False) self.svc = RappPlatformService(persistent=True) self.valid_faces = [{ 'up_left_point': {'y': 275.0, 'x': 606.0}, 'down_right_point': {'y': 576.0, 'x': 907.0} }]
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') imagepath = path.join(pkgDir, 'test_data','qr_samples', 'hardFarQr.jpg') self.msg = QrDetection(imageFilepath=imagepath) self.svc = RappPlatformService(msg=self.msg) self.valid_results = { 'qr_centers': [{'y': 580, 'x': 669}], 'qr_messages': ['This QR will be used to check the algorithmic robustness as it is quite small'], 'error': '' }
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.msg = NewsExplore( news_engine='', keywords=[], exclude_titles=[], region='', topic='', num_news=5) self.svc = RappPlatformService(self.msg)
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_sentence2.ogg') self.msg = SpeechRecognitionGoogle( language='en', audio_source='nao_ogg', audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = ['check', 'my', 'mail']
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'thelw-voithia.wav') self.msg = SpeechRecognitionSphinx( language='el', audio_source='nao_wav_1_ch', words=[u'θέλω', u'βοήθεια'], sentences=[u'θέλω', u'βοήθεια'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'θέλω', u'βοήθεια']
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'deutera.wav') self.msg = SpeechRecognitionSphinx( language='el', audio_source='headset', words=[u'Δευτέρα'], sentences=[u'Δευτέρα'], grammar=[u'Δευτέρα'], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'Δευτέρα']
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_tuesday.ogg') self.msg = SpeechRecognitionSphinx( language='en', audio_source='nao_ogg', words=[u'tuesday', u'monday'], sentences=[u'tuesday', u'monday'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'tuesday']
def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') zipFile = join(pkgDir, 'test_data', 'zip_files', \ 'image_audio_sample.zip') self.msg = EmailSend( email='*****@*****.**', password='', server='smtp.gmail.com', port='587', recipients=['*****@*****.**', '*****@*****.**'], body='Rapp Send Email Test', subject='Rapp Send Email Test', attach_file=zipFile) self.svc = RappPlatformService(self.msg)
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_tuesday.ogg') self.msg = SpeechRecognitionSphinx( language='en', audio_source='nao_ogg', words=[u'tuesday', u'monday'], sentences=[u'tuesday', u'monday'], grammar=[], audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = [u'tuesday'] def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if self.valid_words_found == response.words: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(response.words), self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') audioFile = path.join(pkgDir, 'test_data', 'speech_detection_samples', 'recording_sentence2.ogg') self.msg = SpeechRecognitionGoogle( language='en', audio_source='nao_ogg', audiofile=audioFile) self.svc = RappPlatformService(self.msg) self.valid_words_found = ['check', 'my', 'mail'] def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] words_found = response.words alt_words_found = response.alternatives if self.valid_words_found == words_found or self.valid_words_found in alt_words_found: return [True, self.elapsed_time] else: return ["Unexpected result : " + str(response), self.elapsed_time]
class RappInterfaceTest: def __init__(self): rospack = rospkg.RosPack() pkgDir = rospack.get_path('rapp_testing_tools') self.msg = NewsExplore( news_engine='', keywords=[], exclude_titles=[], region='', topic='', num_news=5) self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): error = response.error if error != "": return [error, self.elapsed_time] if len(response.news_stories) == self.svc.num_news: return [True, self.elapsed_time] else: return ["Unexpected result : " + \ ' Number of news stories requested -> ' + \ str(self.svc.num_news) + ', received -> ' + \ str(len(response.news_stories)), self.elapsed_time]
class RappInterfaceTest: def __init__(self): self.msg = WeatherReportCurrent() self.msg.req.city = 'Athens' self.msg.req.weather_reporter = '' self.msg.req.metric = 0 self.svc = RappPlatformService(self.msg) def execute(self): start_time = timeit.default_timer() response = self.svc.call() end_time = timeit.default_timer() self.elapsed_time = end_time - start_time return self.validate(response) def validate(self, response): if not response.error: return [True, self.elapsed_time] else: return [response.error, self.elapsed_time]