18 lines
704 B
Python
18 lines
704 B
Python
import unittest
|
|
|
|
from failure import Failure
|
|
from plan.goals_file import section
|
|
|
|
GOALS_FILE = "# P\n## Goals\n1. g\n## Audience\nme\n"
|
|
|
|
|
|
class Section(unittest.TestCase):
|
|
def test_gives_the_text_under_the_one_heading(self):
|
|
self.assertEqual(section(GOALS_FILE, "Goals"), "1. g")
|
|
self.assertEqual(section(GOALS_FILE, "Audience"), "me")
|
|
|
|
def test_says_what_the_goals_file_lacks(self):
|
|
self.assertEqual(section(GOALS_FILE, "Method"), Failure("has no ## Method heading"))
|
|
self.assertEqual(section(GOALS_FILE + "## Audience\nyou\n", "Audience"), Failure("has ## Audience more than once"))
|
|
self.assertEqual(section("## Goals\n\n## Audience\nme\n", "Goals"), Failure("has no text under ## Goals"))
|