コード例 #1
0
  def test7(self):
    poetry = Poetry()
    poem = ["too bad   your",
             "     solution went   sour"]
    expected = "aa"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #2
0
  def test1(self):
    poetry   = Poetry()
    poem     = ["I hope this problem",
                "is a whole lot better than",
                "this stupid haiku"]
    expected = "abc"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #3
0
  def test4(self):
    poetry = Poetry()
    poem = ["",
            "",
            "",
            ""]
    expected = "    "

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #4
0
  def test5(self):
    poetry = Poetry()
    poem = ["This poem has uppercase letters",
            "In its rhyme scheme",
            "Alpha", "Blaster", "Cat", "Desert", "Elephant", "Frog", "Gulch", 
            "Horse", "Ireland", "Jam", "Krispy Kreme", "Loofah", "Moo",
            "Narf",
            "Old", "Pink", "Quash", "Rainbow", "Star", "Tour", "Uvula",
            "Very",
            "Will", "Xmas", "Young", "Zed", "deception", "comic", "grout",
            "oval", "cable", "rob", "steal", "steel", "weak"]
    expected = "abcdefghibjkblmnopqrstcuvwxyzABCbDEFG"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #5
0
  def test3(self):
    poetry = Poetry()
    poem = ["One bright day in the middle of the night",
            "Two dead boys got up to fight",
            "Back to back they faced each other",
            "Drew their swords and shot each other",
            "",
            "A deaf policeman heard the noise",
            "And came to arrest the two dead boys",
            "And if you dont believe this lie is true",
            "Ask the blind man he saw it too"]
    expected = "aabb cdef"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #6
0
  def test2(self):
    poetry = Poetry()
    poem = ["     ",
            "Measure your height",
            "AND WEIGHT      ",
            "said the doctor",
            "",
            "And make sure to take your pills",
            "   to   cure   your    ills",
            "Every",
            "DAY"]
    expected = " aab ccde"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)
コード例 #7
0
  def test6(self):
    poetry = Poetry()
    poem = ["                         " ,
            "                         " ,
            " This poem               " ,
            "                         " ,
            "                         " ,
            "                         " ,
            "                         " ,
            " Has lots of blank lines " ,
            "                         " ,
            "                         " ,
            "                         " ,
            "                         " ,
            "                         " ,
            "                         " ,
            "                         " ,
            " in      it              " ]
    expected = "  a    b       c"

    results = poetry.rhymeScheme(poem)

    self.assertEqual(expected, results)