Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2767 from forslund/bugfix/anonymous-AdaptIntent
Browse files Browse the repository at this point in the history
Bugfix/anonymous adapt intent
  • Loading branch information
krisgesling authored Dec 1, 2020
2 parents acd6753 + 21425da commit da280e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mycroft/skills/intent_services/adapt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
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):
Expand Down
13 changes: 12 additions & 1 deletion test/unittests/skills/test_intent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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

Expand Down Expand Up @@ -327,3 +327,14 @@ def test_get_no_match_after_detach_skill(self):
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, "")

0 comments on commit da280e3

Please sign in to comment.