-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fixed file loading of non proper UTF-8 story files, failing properly when checking for | ||
story files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import glob | ||
import os | ||
|
||
from pathlib import Path | ||
|
||
from rasa.data import is_story_file | ||
from rasa.utils.io import write_text_file | ||
|
||
|
||
def test_story_file_can_not_be_yml(tmpdir: Path): | ||
p = tmpdir / "test_non_md.yml" | ||
Path(p).touch() | ||
assert is_story_file(str()) is False | ||
|
||
|
||
def test_empty_story_file_is_not_story_file(tmpdir: Path): | ||
p = tmpdir / "test_non_md.md" | ||
Path(p).touch() | ||
assert is_story_file(str(p)) is False | ||
|
||
|
||
def test_story_file_with_minimal_story_is_story_file(tmpdir: Path): | ||
p = tmpdir / "story.md" | ||
s = """ | ||
## my story | ||
""" | ||
write_text_file(s, p) | ||
assert is_story_file(str(p)) | ||
|
||
|
||
def test_default_story_files_are_story_files(): | ||
for fn in glob.glob(os.path.join("data", "test_stories", "*")): | ||
assert is_story_file(fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters