Example #1
0
    def test_failing_args_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            assert isinstance(kan, str)

        with self.assertRaises(AssertionError):
            _validate_function([validate], func, (3, ), {})
Example #2
0
    def test_failing_args_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            assert isinstance(kan, str)

        with self.assertRaises(AssertionError):
            _validate_function([validate], func, (3,), {})
Example #3
0
    def test_too_many_iterations(self):
        def func(foo):
            return foo

        def validate(kan):
            yield
            yield

        with self.assertRaises(RuntimeError):
            _validate_function([validate], func, (3, ), {})
Example #4
0
    def test_too_many_iterations(self):
        def func(foo):
            return foo

        def validate(kan):
            yield
            yield

        with self.assertRaises(RuntimeError):
            _validate_function([validate], func, (3,), {})
Example #5
0
    def test_non_acting_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            yield

        self.assertEqual(_validate_function([validate], func, (3, ), {}), 3)
Example #6
0
    def test_empty_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            """Nothing here"""

        self.assertEqual(_validate_function([validate], func, (3, ), {}), 3)
Example #7
0
    def test_non_acting_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            yield

        self.assertEqual(_validate_function([validate], func, (3,), {}), 3)
Example #8
0
    def test_empty_validator(self):
        def func(foo):
            return foo

        def validate(kan):
            """Nothing here"""

        self.assertEqual(_validate_function([validate], func, (3,), {}), 3)