Example #1
0
class VariableInputTypeAdapterTests(ChatBotTestCase):

    def setUp(self):
        super().setUp()
        self.adapter = VariableInputTypeAdapter(self.chatbot)

    def test_statement_returned_dict(self):
        data = {
            'text': 'Robot ipsum datus scan amet.',
            'in_response_to': []
        }
        response = self.adapter.process_input(data)

        self.assertEqual(response.text, data['text'])

    def test_statement_returned_text(self):
        text = 'The test statement to process is here.'
        response = self.adapter.process_input(text)

        self.assertEqual(response.text, text)

    def test_statement_returned_object(self):
        statement = Statement('The test statement to process is here.')
        response = self.adapter.process_input(statement)

        self.assertEqual(response.text, statement.text)

    def test_invalid_input_type(self):
        data = ['A list', 'of text', 'is an', 'invalid input type.']

        with self.assertRaises(VariableInputTypeAdapter.UnrecognizedInputFormatException):
            self.adapter.process_input(data)
class VariableInputTypeAdapterTests(TestCase):

    def setUp(self):
        self.adapter = VariableInputTypeAdapter()

    def test_statement_returned_dict(self):
        data = {
            'text': 'Robot ipsum datus scan amet.',
            'in_response_to': []
        }
        response = self.adapter.process_input(data)

        self.assertEqual(response.text, data['text'])

    def test_statement_returned_text(self):
        text = 'The test statement to process is here.'
        response = self.adapter.process_input(text)

        self.assertEqual(response.text, text)

    def test_statement_returned_object(self):
        statement = Statement('The test statement to process is here.')
        response = self.adapter.process_input(statement)

        self.assertEqual(response.text, statement.text)

    def test_invalid_input_type(self):
        data = ['A list', 'of text', 'is an', 'invalid input type.']

        with self.assertRaises(VariableInputTypeAdapter.UnrecognizedInputFormatException):
            self.adapter.process_input(data)
    def test_variable_type_input_adapter(self):
        from chatterbot.input import VariableInputTypeAdapter

        adapter = VariableInputTypeAdapter()

        statement = Statement(text='_')

        result = adapter.process_input(statement)

        self.assertEqual(result.text, '_')
Example #4
0
 def setUp(self):
     super().setUp()
     self.adapter = VariableInputTypeAdapter(self.chatbot)
 def setUp(self):
     self.adapter = VariableInputTypeAdapter()
Example #6
0
 def setUp(self):
     self.adapter = VariableInputTypeAdapter()
     self.conversation = 'test'
 def setUp(self):
     self.adapter = VariableInputTypeAdapter()