Exemplo n.º 1
0
 def getValue(self):
   #TODO(sttwister): This could be improved
   markdown = ''
   for _ in range(random.randint(5, 10)):
     markdown += RandomPhraseProvider.getValue(self) + '\n===\n\n'
     markdown += RandomParagraphProvider.getValue(self) + '\n\n'
   return markdown
Exemplo n.º 2
0
 def getValue(self):
   #TODO(sttwister): This could be improved
   markdown = ''
   for _ in range(random.randint(5, 10)):
     markdown += RandomPhraseProvider.getValue(self) + '\n===\n\n'
     markdown += RandomParagraphProvider.getValue(self) + '\n\n'
   return markdown
Exemplo n.º 3
0
 def getValue(self):
   #TODO(sttwister): This could be improved
   html = '<html><body>'
   for _ in range(random.randint(5, 10)):
     html += '<h1>' + RandomPhraseProvider.getValue(self) + '</h1>'
     html += '<p>' + RandomParagraphProvider.getValue(self) + '</p>'
   html += '</body></html>'
   return html
Exemplo n.º 4
0
 def getValue(self):
   #TODO(sttwister): This could be improved
   html = '<html><body>'
   for _ in range(random.randint(5, 10)):
     html += '<h1>' + RandomPhraseProvider.getValue(self) + '</h1>'
     html += '<p>' + RandomParagraphProvider.getValue(self) + '</p>'
   html += '</body></html>'
   return html
Exemplo n.º 5
0
class RandomPhraseProviderTest(unittest.TestCase):
  """Test class for RandomPhraseProvider.
  """

  def setUp(self):
    self.provider = RandomPhraseProvider()

  def testGetValue(self):
    """Tests getValue().
    """
    value = self.provider.getValue()
    self.assertTrue(self.provider.DEFAULT_MIN_WORDS <= len(value.split(' ')) <=
                    self.provider.DEFAULT_MAX_WORDS)

  def testInvalidParameters(self):
    """Tests getValue() with invalid user supplied parameters.
    """
    min_words = 'asdf'
    max_words = None
    self.provider.param_values = {'min_words': min_words,
                                  'max_words': max_words}
    self.assertRaises(ParameterValueError, self.provider.getValue)
Exemplo n.º 6
0
 def getValue(self):
   return ' '.join(RandomPhraseProvider.getValue(self)
                   for _ in range(random.randint(5, 10)))
Exemplo n.º 7
0
 def getValue(self):
   return ' '.join(RandomPhraseProvider.getValue(self)
                   for _ in range(random.randint(5, 10)))
Exemplo n.º 8
0
 def setUp(self):
   self.provider = RandomPhraseProvider()