コード例 #1
0
    def test_should_raise_exception_when_callable_argument_cannot_be_satisfied(
            self):
        def callable(spam):
            pass

        executable = Executable("callable", callable)
        self.assertRaises(ValueError, executable.execute, {})
コード例 #2
0
    def test_should_execute_callable_without_arguments(self):
        def callable():
            callable.called = True

        callable.called = False

        Executable("callable", callable).execute({})

        self.assertTrue(callable.called)
コード例 #3
0
    def test_should_execute_callable_with_single_arguments(self):
        def callable(spam):
            callable.called = True
            callable.spam = spam

        callable.called = False

        Executable("callable", callable).execute({"spam": "spam"})

        self.assertTrue(callable.called)
        self.assertEquals("spam", callable.spam)