Merge pull request #2767 from forslund/bugfix/anonymous-AdaptIntent
Bugfix/anonymous adapt intentpull/2762/head
commit
da280e360c
|
@ -26,9 +26,11 @@ from .base import IntentMatch
|
|||
class AdaptIntent(IntentBuilder):
|
||||
"""Wrapper for IntentBuilder setting a blank name.
|
||||
|
||||
This is mainly here for backwards compatibility, adapt now support
|
||||
automatically named IntentBulders.
|
||||
Arguments:
|
||||
name (str): Optional name of intent
|
||||
"""
|
||||
def __init__(self, name=''):
|
||||
super().__init__(name)
|
||||
|
||||
|
||||
def _strip_result(context_features):
|
||||
|
|
|
@ -19,7 +19,7 @@ from adapt.intent import IntentBuilder
|
|||
from mycroft.configuration import Configuration
|
||||
from mycroft.messagebus import Message
|
||||
from mycroft.skills.intent_service import (ContextManager, IntentService,
|
||||
_get_message_lang)
|
||||
_get_message_lang, AdaptIntent)
|
||||
|
||||
from test.util import base_config
|
||||
|
||||
|
@ -327,3 +327,14 @@ class TestIntentServiceApi(TestCase):
|
|||
self.intent_service.handle_get_adapt(msg)
|
||||
reply = get_last_message(self.intent_service.bus)
|
||||
self.assertEqual(reply.data['intent'], None)
|
||||
|
||||
|
||||
class TestAdaptIntent(TestCase):
|
||||
"""Test the AdaptIntent wrapper."""
|
||||
def test_named_intent(self):
|
||||
intent = AdaptIntent("CallEaglesIntent")
|
||||
self.assertEqual(intent.name, "CallEaglesIntent")
|
||||
|
||||
def test_unnamed_intent(self):
|
||||
intent = AdaptIntent()
|
||||
self.assertEqual(intent.name, "")
|
||||
|
|
Loading…
Reference in New Issue