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))
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)
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)
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)
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
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