コード例 #1
0
ファイル: test_operators.py プロジェクト: xuzhuwukong/djblets
    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
ファイル: test_values.py プロジェクト: xuzhuwukong/djblets
    def setUp(self):
        super(ConditionValueIntegerFieldTests, self).setUp()

        self.value_field = ConditionValueIntegerField()
コード例 #4
0
 class MyOperator(BaseConditionOperator):
     operator_id = 'my-op'
     name = 'My Op'
     value_field = ConditionValueIntegerField()