コード例 #1
0
class TestThreeWordInput(TestCase):
    def setUp(self):
        self.dictionary = MarkovDictionary()
        self.source_text = "drink me now."
        self.dictionary.engorge(self.source_text)

    def test_disgorging_one_word(self):
        output = self.dictionary.disgorge(1)
        output_length = len(output.split(" "))
        self.assertEqual(output_length, 1)

    def test_disgorging_ten_words(self):
        output = self.dictionary.disgorge(10)
        length = len(output.split(" "))
        self.assertEqual(length, 10)

    def test_three_words_in_lexicon(self):
        length = len(self.dictionary.get_lexicon())
        self.assertEqual(length, 3)
コード例 #2
0
ファイル: test_markov.py プロジェクト: joshcampbell/markov
class TestThreeWordInput(TestCase):

  def setUp(self):
    self.dictionary = MarkovDictionary()
    self.source_text = "drink me now."
    self.dictionary.engorge(self.source_text)

  def test_disgorging_one_word(self):
    output = self.dictionary.disgorge(1)
    output_length = len(output.split(" "))
    self.assertEqual(output_length, 1)

  def test_disgorging_ten_words(self):
    output = self.dictionary.disgorge(10)  
    length = len(output.split(" "))
    self.assertEqual(length, 10)

  def test_three_words_in_lexicon(self):
    length = len(self.dictionary.get_lexicon())
    self.assertEqual(length, 3)
コード例 #3
0
def markov():
    return MarkovDictionary(request.get_data()).disgorge(600)
コード例 #4
0
 def setUp(self):
     self.dictionary = MarkovDictionary()
     self.source_text = "drink me now."
     self.dictionary.engorge(self.source_text)
コード例 #5
0
ファイル: test_markov.py プロジェクト: joshcampbell/markov
 def setUp(self):
   self.dictionary = MarkovDictionary()
   self.source_text = "drink me now."
   self.dictionary.engorge(self.source_text)