Skip to content

Commit

Permalink
use yaml spec 1.2 so that yes does not get parsed to boolean value …
Browse files Browse the repository at this point in the history
…`True`
  • Loading branch information
wochinge committed Nov 19, 2018
1 parent 155f82e commit 7fd27ab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions data/examples/rasa/demo-rasa.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
],
"common_examples": [
{
"text": "hey",
"text": "hey",
"intent": "greet",
"entities": []
},
{
"text": "howdy",
"text": "howdy",
"intent": "greet",
"entities": []
},
Expand Down
2 changes: 1 addition & 1 deletion rasa_nlu/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def read_yaml(content):
replace_environment_variables()

yaml_parser = yaml.YAML(typ="safe")
yaml_parser.version = "1.1"
yaml_parser.version = "1.2"
yaml_parser.unicode_supplementary = True

return yaml_parser.load(content)
Expand Down
14 changes: 14 additions & 0 deletions tests/base/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,17 @@ def test_emojis_in_tmp_file():

assert actual["data"][0] == "one 😁"
assert actual["data"][1] == "two £"


def test_bool_str():
test_data = """
one: "yes"
two: "true"
three: "True"
"""

actual = utils.read_yaml(test_data)

assert actual["one"] == "yes"
assert actual["two"] == "true"
assert actual["three"] == "True"

0 comments on commit 7fd27ab

Please sign in to comment.