def test__was_called_with__can_pass(): some_instance = SomeClass() stub(some_instance, some_instance.some_method) some_instance.some_method("some-positional-argument", ["some-array-content"]) expect(some_instance.some_method).was_called_with( "some-positional-argument", ["some-array-content"])
def test__was_called_with__when_there_were_no_calls__fails_with_a_message(): some_instance = SomeClass() stub(some_instance, some_instance.some_method) expect_expectation_to_fail_with_message( lambda: expect(some_instance.some_method).was_called_with( "some-positional-argument", ["some-array-content"]), "Expected that <SomeClass#some_method> was called with <\('some-positional-argument', \['some-array-content'\]\)> but it was never called" )
def test__was_called_with_matcher__when_there_were_no_calls__fails_with_a_message( ): some_instance = SomeClass() stub(some_instance, some_instance.some_method) expect_expectation_to_fail_with_message( lambda: expect(some_instance.some_method).to_be( was_called_with("some-positional-argument", ["some-array-content"]) ), "Expected <.*> to be <was_called_with\(.*>")