コード例 #1
0
ファイル: test_data.py プロジェクト: sanaayakurup/rasa-1
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 data.is_story_file(str(p))
コード例 #2
0
    def _init_from_directory(self, path: Text):
        for parent, _, files in os.walk(path):
            for file in files:
                full_path = os.path.join(parent, file)
                if not self.is_imported(full_path):
                    # Check next file
                    continue

                if data.is_domain_file(full_path):
                    self._domain_paths.append(full_path)
                elif data.is_nlu_file(full_path):
                    self._nlu_paths.append(full_path)
                elif data.is_story_file(full_path):
                    self._story_paths.append(full_path)
                elif data.is_config_file(full_path):
                    self._init_from_file(full_path)
コード例 #3
0
ファイル: multi_project.py プロジェクト: sanaayakurup/rasa-1
    def _init_from_directory(self, path: Text):
        for parent, _, files in os.walk(path, followlinks=True):
            for file in files:
                full_path = os.path.join(parent, file)
                if not self.is_imported(full_path):
                    # Check next file
                    continue

                if data.is_end_to_end_conversation_test_file(full_path):
                    self._e2e_story_paths.append(full_path)
                elif Domain.is_domain_file(full_path):
                    self._domain_paths.append(full_path)
                elif data.is_nlu_file(full_path):
                    self._nlu_paths.append(full_path)
                elif data.is_story_file(full_path):
                    self._story_paths.append(full_path)
                elif data.is_config_file(full_path):
                    self._init_from_file(full_path)
コード例 #4
0
ファイル: test_data.py プロジェクト: sanaayakurup/rasa-1
def test_default_story_files_are_story_files():
    for fn in glob.glob(os.path.join("data", "test_stories", "*")):
        assert data.is_story_file(fn)
コード例 #5
0
ファイル: test_data.py プロジェクト: sanaayakurup/rasa-1
def test_empty_story_file_is_not_story_file(tmpdir: Path):
    p = tmpdir / "test_non_md.md"
    Path(p).touch()
    assert data.is_story_file(str(p)) is False
コード例 #6
0
ファイル: test_data.py プロジェクト: sanaayakurup/rasa-1
def test_story_file_can_not_be_yml(tmpdir: Path):
    p = tmpdir / "test_non_md.yml"
    Path(p).touch()
    assert data.is_story_file(str()) is False