def test_should_invoke_test_function_four_times_when_two_fixtures_each_provide_two_values(self): function = InvocationCountingFunctionMock() test_definition = TestDefinition(function, "unittest", "unittest", "module", {"spam": enumerate("spam", "eggs"), "foo": enumerate("foo", "bar")}) self.injector.execute_test(test_definition) assert_that(function.invocation_counter).equals(4) assert_that(function.invocation_arguments).contains({"spam": "spam", "foo": "foo"}) assert_that(function.invocation_arguments).contains({"spam": "spam", "foo": "bar"}) assert_that(function.invocation_arguments).contains({"spam": "eggs", "foo": "foo"}) assert_that(function.invocation_arguments).contains({"spam": "eggs", "foo": "bar"})
def test_should_invoke_test_function_twice_when_fixture_provides_two_values(self): function = InvocationCountingFunctionMock() test_definition = TestDefinition(function, "unittest", "unittest", "module", {"spam": enumerate("spam", "eggs")}) self.injector.execute_test(test_definition) assert_that(function.invocation_counter).equals(2)
def test_ensure_that_provide_returns_set_value(self): actual = enumerate("spam", "eggs").provide() assert_that(len(actual)).equals(2) assert_that(actual[0]).equals("spam") assert_that(actual[1]).equals("eggs")