Exemplo n.º 1
0
    def test_term_validate_term_raises_exception_if_argument_not_of_list_type(
            self):
        test_list = (1, True, 3)
        exc = None

        try:
            Term.validate_term(test_list)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'Argument must be of "list" type.')
Exemplo n.º 2
0
    def test_term_validate_term_raises_exception_if_length_of_list_is_not_three(
            self):
        test_list = [1, True, 3, 5]
        exc = None

        try:
            Term.validate_term(test_list)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc), 'List must contain 3 elements.')
Exemplo n.º 3
0
    def test_term_validate_term_raises_exception_if_third_elem_of_list_not_int_or_none(
            self):
        test_list = [1, True, '3']
        exc = None

        try:
            Term.validate_term(test_list)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(
            str(exc), 'Third element of list must be of "int" type or None.')
Exemplo n.º 4
0
    def test_term_validate_term_raises_exception_if_second_elem_of_list_not_bool_or_none(
            self):
        test_list = [1, 'False', 3]
        exc = None

        try:
            Term.validate_term(test_list)
        except Exception as err:
            exc = err

        self.assertIsNotNone(exc)
        self.assertEqual(str(exc),
                         'Second element of list must be of "bool" type.')
Exemplo n.º 5
0
    def test_term_validate_term_passes_with_correct_input(self):
        test_list = [1, True, 3]

        Term.validate_term(test_list)