Exemplo n.º 1
0
 def test_fieldset_operator(self):
     """
     Tests that the correct fieldset operator is mapped to the
     operator.
     """
     self.assertEqual(
         FieldOperator('>', FieldTypes.INT).fieldset_operator,
         'gt',
     )
Exemplo n.º 2
0
    def test_mising_field_mapping(self):
        """
        Tests that a NO_FIELD_MAPPING error is added to the list of
        operator errors if the field_type is unknown.
        """
        operator = FieldOperator('=', 'test')

        self.assertEqual(len(operator.errors), 1)
        self.assertEqual(operator.errors[0],
                         FieldOperator.NO_FIELD_MAPPING.format('test'))
Exemplo n.º 3
0
    def test_mismatched_operator(self):
        """
        Tests that a MISMATCHED_OPERATOR error is added to the list
        of errors if the given operator is not assigned to the given
        field_type.
        """
        operator = FieldOperator('>', FieldTypes.CHAR)

        self.assertEqual(len(operator.errors), 1)
        self.assertEqual(
            operator.errors[0],
            FieldOperator.MISMATCHED_OPERATOR.format('>', FieldTypes.CHAR))