def test_when_paragraph(self): lines = [ ' Brown cut up pieces of meat.Season with chili powder,salt and black', ' pepper.Add chopped vegetables and V - 8 vegetable juice. Add ketchup', ' and Worcestershire sauce to taste.', ] expected = [ 'Brown cut up pieces of meat.Season with chili powder,salt and black pepper.Add chopped vegetables and V - 8 vegetable juice. Add ketchup and Worcestershire sauce to taste.', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_paragraph(self): lines = [ ' Brown cut up pieces of meat.Season with chili powder,salt and black', ' pepper.Add chopped vegetables and V - 8 vegetable juice. Add ketchup', ' and Worcestershire sauce to taste.', ] expected = [ 'Brown cut up pieces of meat.Season with chili powder,salt and black pepper.Add chopped vegetables and V - 8 vegetable juice. Add ketchup and Worcestershire sauce to taste.', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_multiple_paragraphs_separated_by_paragraph_marker(self): lines = [ ' The kind of chiles that you use determine the final flavor, you can', ' experiment with different kinds or mixing the different kinds of chiles.', ' But this is the basic recipe for prepare salsas with dry chiles.\x14', ' Wash the chiles in water and discard the seeds and threads of chiles. Let', ' stand in water at least 2 or 3 hours or all the night, if you do not have', ' time let the chiles in warm water at least 30 min.\x14', ' Then ground with the other ingredients.', ] expected = [ 'The kind of chiles that you use determine the final flavor, you can experiment with different kinds or mixing the different kinds of chiles. But this is the basic recipe for prepare salsas with dry chiles.', 'Wash the chiles in water and discard the seeds and threads of chiles. Let stand in water at least 2 or 3 hours or all the night, if you do not have time let the chiles in warm water at least 30 min.', 'Then ground with the other ingredients.', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_more_extra_lines(self): lines = [ ' ', ' ', ' Brown cut up pieces of meat.', ' ', ' Brown cut up pieces of meat!', ' ', ' ', ' ', ] expected = [ 'Brown cut up pieces of meat.', 'Brown cut up pieces of meat!', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_multiple_paragraphs_separated_by_paragraph_marker(self): lines = [ ' The kind of chiles that you use determine the final flavor, you can', ' experiment with different kinds or mixing the different kinds of chiles.', ' But this is the basic recipe for prepare salsas with dry chiles.\x14', ' Wash the chiles in water and discard the seeds and threads of chiles. Let', ' stand in water at least 2 or 3 hours or all the night, if you do not have', ' time let the chiles in warm water at least 30 min.\x14', ' Then ground with the other ingredients.', ] expected = [ 'The kind of chiles that you use determine the final flavor, you can experiment with different kinds or mixing the different kinds of chiles. But this is the basic recipe for prepare salsas with dry chiles.', 'Wash the chiles in water and discard the seeds and threads of chiles. Let stand in water at least 2 or 3 hours or all the night, if you do not have time let the chiles in warm water at least 30 min.', 'Then ground with the other ingredients.', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_more_extra_lines(self): lines = [ ' ', ' ', ' Brown cut up pieces of meat.', ' ', ' Brown cut up pieces of meat!', ' ', ' ', ' ', ] expected = [ 'Brown cut up pieces of meat.', 'Brown cut up pieces of meat!', ] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_single_line(self): lines = [' Brown cut up pieces of meat.'] expected = ['Brown cut up pieces of meat.'] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_empty(self): lines = [''] expected = [] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_single_line(self): lines = [' Brown cut up pieces of meat.'] expected = ['Brown cut up pieces of meat.'] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)
def test_when_empty(self): lines = [''] expected = [] actual = mmf._paragraphize_directions(lines) self.assertEqual(actual, expected)