Skip to content

Commit

Permalink
include review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Christina Koss committed May 14, 2020
1 parent f61d372 commit 1c7aadf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion rasa/core/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def from_yaml(cls, yaml: Text) -> "Domain":

@classmethod
def from_dict(cls, data: Dict) -> "Domain":
data = copy.deepcopy(data)
utter_templates = cls.collect_templates(data.get("responses", {}))
if "templates" in data:
raise_warning(
Expand Down
25 changes: 20 additions & 5 deletions tests/core/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,6 @@ def test_clean_domain_deprecated_templates():


def test_add_knowledge_base_slots(default_domain):
import copy

# don't modify default domain as it is used in other tests
test_domain = copy.deepcopy(default_domain)

Expand Down Expand Up @@ -806,9 +804,26 @@ def test_domain_utterance_actions_deprecated_templates():


def test_domain_from_dict_does_not_change_input():
path = DEFAULT_DOMAIN_PATH_WITH_SLOTS
input_before = io_utils.read_yaml(io_utils.read_file(path))
input_after = copy.deepcopy(input_before)
input_before = {
"intents": [
{"greet": {USE_ENTITIES_KEY: ["name"]}},
{"default": {IGNORE_ENTITIES_KEY: ["unrelated_recognized_entity"]}},
{"goodbye": {USE_ENTITIES_KEY: None}},
{"thank": {USE_ENTITIES_KEY: False}},
{"ask": {USE_ENTITIES_KEY: True}},
{"why": {USE_ENTITIES_KEY: []}},
"pure_intent",
],
"entities": ["name", "unrelated_recognized_entity", "other"],
"slots": {"name": {"type": "text"}},
"responses": {
"utter_greet": [{"text": "hey there {name}!"}],
"utter_goodbye": [{"text": "goodbye 😢"}, {"text": "bye bye 😢"}],
"utter_default": [{"text": "default message"}],
},
}

input_after = copy.deepcopy(input_before)
Domain.from_dict(input_after)

assert input_after == input_before

0 comments on commit 1c7aadf

Please sign in to comment.