-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
19be583
commit 2ae86db
Showing
3 changed files
with
58 additions
and
6 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
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
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,30 @@ | ||
from tests.base_case import ChatBotTestCase | ||
from chatterbot import trainers | ||
from chatterbot import preprocessors | ||
|
||
|
||
class PreprocessorTrainingTests(ChatBotTestCase): | ||
""" | ||
These tests are designed to ensure that preprocessors | ||
will be used to process the input the chat bot is given | ||
during the training process. | ||
""" | ||
|
||
def test_training_cleans_whitespace(self): | ||
""" | ||
Test that the ``clean_whitespace`` preprocessor is used during | ||
the training process. | ||
""" | ||
self.chatbot.preprocessors = [preprocessors.clean_whitespace] | ||
self.chatbot.set_trainer(trainers.ListTrainer) | ||
|
||
self.chatbot.train([ | ||
'Can I help you with anything?', | ||
'No, I think I am all set.', | ||
'Okay, have a nice day.', | ||
'Thank you, you too.' | ||
]) | ||
|
||
response = self.chatbot.get_response('Can I help you with anything?') | ||
|
||
self.assertEqual(response.text, 'No, I think I am all set.') |