示例#1
0
    def test_with_overrides(self):
        """Testing BaseConditionOperator.with_overrides"""
        class MyOperator(BaseConditionOperator):
            operator_id = 'my-op'
            name = 'My Op'

            value_field = BaseConditionValueField()

        CustomOperator = MyOperator.with_overrides(
            name='Custom Op', value_field=ConditionValueIntegerField())

        self.assertEqual(CustomOperator.__name__, 'CustomMyOperator')
        self.assertEqual(CustomOperator.name, 'Custom Op')
        self.assertIs(CustomOperator.value_field.__class__,
                      ConditionValueIntegerField)
示例#2
0
class BaseConditionIntegerChoice(BaseConditionChoice):
    """Base class for a standard integer-based condition choice.

    This is a convenience for choices that are based on integers. It provides
    some standard operators that work well with integers for checking.
    """

    operators = ConditionOperators([
        IsOperator,
        IsNotOperator,
        GreaterThanOperator,
        LessThanOperator,
    ])

    default_value_field = ConditionValueIntegerField()
示例#3
0
    def setUp(self):
        super(ConditionValueIntegerFieldTests, self).setUp()

        self.value_field = ConditionValueIntegerField()
 class MyOperator(BaseConditionOperator):
     operator_id = 'my-op'
     name = 'My Op'
     value_field = ConditionValueIntegerField()