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

Bugfix/anonymous adapt intent #2767

Merged
merged 2 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, "")