def test_each_chapter_follows_the_last(chapter): chapter_no = CHAPTERS.index(chapter) if chapter_no == 0: return previous = CHAPTERS[chapter_no - 1] if previous in BRANCHES: previous = CHAPTERS[chapter_no - 2] assert f'{previous})' in git_log(chapter), f'{chapter} did not follow {previous}'
def previous_chapter(chapter): chapter_no = CHAPTERS.index(chapter) if chapter_no == 0: return None previous = CHAPTERS[chapter_no - 1] if previous in BRANCHES: previous = CHAPTERS[chapter_no - 2] return previous