コード例 #1
0
    def test_should_collect_after_interceptors(self):
        def some_function():
            pass

        after_interceptors = ["spam", "eggs"]
        setattr(some_function, AFTER_ATTRIBUTE, after_interceptors)

        test = TestDefinition.from_function(some_function)

        assert_that(test.after_interceptors).is_equal_to(after_interceptors)
コード例 #2
0
    def test_should_construct_test_from_function_with_camelcase_name(self):
        def someFunction():
            "This is my description"

        test = TestDefinition.from_function(someFunction)

        assert_that(test.function).is_identical_to(someFunction)
        assert_that(test.name).is_equal_to("Some function")
        assert_that(test.description).is_equal_to("This is my description")
        assert_that(test.module).is_equal_to(__name__)
コード例 #3
0
    def test_should_collect_before_interceptors(self):
        def some_function():
            pass

        before_interceptors = ["spam", "eggs"]
        setattr(some_function, BEFORE_ATTRIBUTE, before_interceptors)

        test = TestDefinition.from_function(some_function)

        assert_that(test.before_interceptors).is_equal_to(before_interceptors)
コード例 #4
0
    def test_should_handle_givens(self):
        def some_function():
            pass

        givens = {"spam": "spam"}
        setattr(some_function, GIVEN_ATTRIBUTE, givens)

        test = TestDefinition.from_function(some_function)

        assert_that(test.givens).is_equal_to(givens)