コード例 #1
0
ファイル: cli.py プロジェクト: edelgm6/draft
def stats():
    """Gets statistics from the project (e.g., word count, etc.)

    :return: word_count, scene_count, sub_chapter_count, chapter_count, section_count
    :rtype: int

    Usage:
      >>> draft stats
      >>> Words: 54034
      >>> Scenes: 67
      >>> Sub-Chapters: 30
      >>> Chapters: 10
      >>> Sections: 3

    """

    generator = Generator()
    generator.confirm_project_layout()

    outliner = Outliner()
    word_count, scene_count, sub_chapter_count, chapter_count, section_count = outliner.get_statistics(
    )

    click.secho("Words: " + str(word_count), fg="green")
    click.secho("Scenes: " + str(scene_count), fg="green")
    click.secho("Sub-Chapters: " + str(sub_chapter_count), fg="green")
    click.secho("Chapters: " + str(chapter_count), fg="green")
    click.secho("Sections: " + str(section_count), fg="green")
コード例 #2
0
ファイル: test_outliner.py プロジェクト: edelgm6/draft
    def test_get_statistics(self):
        outliner = Outliner()
        word_count, scene_count, sub_chapter_count, chapter_count, section_count = outliner.get_statistics(
        )

        self.assertEqual(word_count, 10)
        self.assertEqual(scene_count, 2)
        self.assertEqual(sub_chapter_count, 1)
        self.assertEqual(chapter_count, 2)
        self.assertEqual(section_count, 2)