Skip to content

Commit

Permalink
Add Django corpus integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Nov 27, 2017
1 parent 741c379 commit 867b13d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/training_tests/test_chatterbot_corpus_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
class ChatterBotCorpusTrainingTestCase(ChatBotTestCase):
"""
Test case for training with data from the ChatterBot Corpus.
Note: This class has a mirror tests_django/integration_tests/
"""

def setUp(self):
Expand Down
43 changes: 43 additions & 0 deletions tests_django/integration_tests/test_chatterbot_corpus_training.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from tests.base_case import ChatBotTestCase
from chatterbot.trainers import ChatterBotCorpusTrainer


class ChatterBotCorpusTrainingTestCase(ChatBotTestCase):
"""
Test case for training with data from the ChatterBot Corpus.
Note: This class has a mirror tests/training_tests/
"""

def setUp(self):
super(ChatterBotCorpusTrainingTestCase, self).setUp()
self.chatbot.set_trainer(ChatterBotCorpusTrainer)

def test_train_with_english_greeting_corpus(self):
self.chatbot.train('chatterbot.corpus.english.greetings')

statement = self.chatbot.storage.find('Hello')

self.assertIsNotNone(statement)

def test_train_with_english_greeting_corpus_tags(self):
self.chatbot.train('chatterbot.corpus.english.greetings')

statement = self.chatbot.storage.find('Hello')

self.assertEqual(['greetings'], statement.get_tags())

def test_train_with_multiple_corpora(self):
self.chatbot.train(
'chatterbot.corpus.english.greetings',
'chatterbot.corpus.english.conversations',
)

statement = self.chatbot.storage.find('Hello')
self.assertIsNotNone(statement)

def test_train_with_english_corpus(self):
self.chatbot.train('chatterbot.corpus.english')
statement = self.chatbot.storage.find('Hello')

self.assertIsNotNone(statement)

0 comments on commit 867b13d

Please sign in to comment.