示例#1
0
    def test_true(self):
        """
        Test with a true condition.
        """

        result = condition(condition='true', statement='count', _else='-count')
        self.assertIs(result, self)
        self.assertEqual(self.count, 1)
示例#2
0
    def test_empty_condition(self):
        """
        Test with an empty condition.
        """

        result = condition(statement='count', _else='-count')
        self.assertIs(result, self)
        self.assertEqual(self.count, -1)
示例#3
0
    def test_empty_action(self):
        """
        Test with an empty statement.
        """

        result = condition(condition='true', _else='-count')
        self.assertIsNone(result)
        self.assertEqual(self.count, 0)
示例#4
0
    def test_empty(self):
        """
        Test condition with no params
        """

        result = condition()
        self.assertIsNone(result)
        self.assertEqual(self.count, 0)
示例#5
0
    def test_false(self):
        """
        Test with a false condition.
        """

        result = condition(
            condition='false', statement='count', _else='-count'
        )
        self.assertIs(result, self)
        self.assertEqual(self.count, -1)