-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
741c379
commit 867b13d
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests_django/integration_tests/test_chatterbot_corpus_training.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |